Add verify for all requests (#345)

* Update downloader.py

* Update segments.py

* Update config_json.py

* Update downloader.py

* Update sweetpixel.py

* Update ddl.py

* Update hdplayer.py

* Update hdplayer.py

* Update maxstream.py

* Update maxstream.py

* Update mediapolisvod.py

* Update mixdrop.py

* Update mixdrop.py

* Update supervideo.py

* Update vixcloud.py

* Update vixcloud.py

* Update update.py
This commit is contained in:
ciccioxm3 2025-06-26 14:06:09 +02:00 committed by github-actions[bot]
parent fd6f2151bc
commit 1e3f964167
13 changed files with 66 additions and 58 deletions

View File

@ -6,10 +6,10 @@
"time_change": "2025-03-19 12:20:19" "time_change": "2025-03-19 12:20:19"
}, },
"cb01new": { "cb01new": {
"domain": "world", "domain": "today",
"full_url": "https://cb01net.world/", "full_url": "https://cb01net.today/",
"old_domain": "rest", "old_domain": "world",
"time_change": "2025-06-25 15:23:57" "time_change": "2025-07-01 07:22:25"
}, },
"animeunity": { "animeunity": {
"domain": "so", "domain": "so",
@ -42,21 +42,21 @@
"time_change": "2025-04-29 12:30:30" "time_change": "2025-04-29 12:30:30"
}, },
"altadefinizione": { "altadefinizione": {
"domain": "blog", "domain": "life",
"full_url": "https://altadefinizionegratis.blog/", "full_url": "https://altadefinizionegratis.life/",
"old_domain": "spa", "old_domain": "blog",
"time_change": "2025-06-24 18:30:00" "time_change": "2025-06-30 21:19:33"
}, },
"streamingcommunity": { "streamingcommunity": {
"domain": "shop", "domain": "life",
"full_url": "https://streamingunity.shop/", "full_url": "https://streamingunity.life/",
"old_domain": "cam", "old_domain": "shop",
"time_change": "2025-06-19 19:15:09" "time_change": "2025-06-29 16:24:39"
}, },
"altadefinizionegratis": { "altadefinizionegratis": {
"domain": "blog", "domain": "life",
"full_url": "https://altadefinizionegratis.blog/", "full_url": "https://altadefinizionegratis.life/",
"old_domain": "vip", "old_domain": "blog",
"time_change": "2025-06-24 18:30:03" "time_change": "2025-06-30 21:19:36"
} }
} }

View File

@ -15,6 +15,7 @@ from StreamingCommunity.Util.headers import get_userAgent
# Variable # Variable
max_timeout = config_manager.get_int("REQUESTS", "timeout") max_timeout = config_manager.get_int("REQUESTS", "timeout")
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
class VideoSource: class VideoSource:
@ -41,7 +42,8 @@ class VideoSource:
url=url, url=url,
headers=self.headers, headers=self.headers,
cookies=self.cookie, cookies=self.cookie,
timeout=max_timeout timeout=max_timeout,
verify=REQUEST_VERIFY
) )
response.raise_for_status() response.raise_for_status()

View File

@ -14,11 +14,12 @@ from StreamingCommunity.Util.config_json import config_manager
# Variable # Variable
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout") MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
class VideoSource: class VideoSource:
def __init__(self, proxy=None): def __init__(self, proxy=None):
self.client = httpx.Client(headers={'user-agent': get_userAgent()}, timeout=MAX_TIMEOUT, proxy=proxy) self.client = httpx.Client(headers={'user-agent': get_userAgent()}, timeout=MAX_TIMEOUT, proxy=proxy, verify=REQUEST_VERIFY)
def extractLinkHdPlayer(self, response): def extractLinkHdPlayer(self, response):
"""Extract iframe source from the page.""" """Extract iframe source from the page."""

View File

@ -18,7 +18,7 @@ from StreamingCommunity.Util.headers import get_userAgent
# Variable # Variable
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout") MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
class VideoSource: class VideoSource:
def __init__(self, url: str): def __init__(self, url: str):
@ -39,7 +39,7 @@ class VideoSource:
Sends a request to the initial URL and extracts the redirect URL. Sends a request to the initial URL and extracts the redirect URL.
""" """
try: try:
response = httpx.get(self.url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT) response = httpx.get(self.url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
response.raise_for_status() response.raise_for_status()
# Extract the redirect URL from the HTML # Extract the redirect URL from the HTML
@ -58,7 +58,7 @@ class VideoSource:
Sends a request to the redirect URL and extracts the Maxstream URL. Sends a request to the redirect URL and extracts the Maxstream URL.
""" """
try: try:
response = httpx.get(self.redirect_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT) response = httpx.get(self.redirect_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
response.raise_for_status() response.raise_for_status()
# Extract the Maxstream URL from the HTML # Extract the Maxstream URL from the HTML
@ -77,12 +77,12 @@ class VideoSource:
# Make request to stayonline api # Make request to stayonline api
data = {'id': self.redirect_url.split("/")[-2], 'ref': ''} data = {'id': self.redirect_url.split("/")[-2], 'ref': ''}
response = httpx.post('https://stayonline.pro/ajax/linkEmbedView.php', headers=headers, data=data) response = httpx.post('https://stayonline.pro/ajax/linkEmbedView.php', headers=headers, data=data, verify=REQUEST_VERIFY)
response.raise_for_status() response.raise_for_status()
uprot_url = response.json()['data']['value'] uprot_url = response.json()['data']['value']
# Retry getting maxtstream url # Retry getting maxtstream url
response = httpx.get(uprot_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT) response = httpx.get(uprot_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
response.raise_for_status() response.raise_for_status()
soup = BeautifulSoup(response.text, "html.parser") soup = BeautifulSoup(response.text, "html.parser")
maxstream_url = soup.find("a").get("href") maxstream_url = soup.find("a").get("href")
@ -104,7 +104,7 @@ class VideoSource:
Sends a request to the Maxstream URL and extracts the .m3u8 file URL. Sends a request to the Maxstream URL and extracts the .m3u8 file URL.
""" """
try: try:
response = httpx.get(self.maxstream_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT) response = httpx.get(self.maxstream_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
response.raise_for_status() response.raise_for_status()
soup = BeautifulSoup(response.text, "html.parser") soup = BeautifulSoup(response.text, "html.parser")

View File

@ -12,7 +12,7 @@ from StreamingCommunity.Util.headers import get_headers
# Variable # Variable
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout") MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
class VideoSource: class VideoSource:
@ -29,7 +29,7 @@ class VideoSource:
return "Error: Unable to determine video JSON URL" return "Error: Unable to determine video JSON URL"
try: try:
response = httpx.get(video_url, headers=get_headers(), timeout=MAX_TIMEOUT) response = httpx.get(video_url, headers=get_headers(), timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
if response.status_code != 200: if response.status_code != 200:
return f"Error: Failed to fetch video data (Status: {response.status_code})" return f"Error: Failed to fetch video data (Status: {response.status_code})"
@ -50,7 +50,7 @@ class VideoSource:
'cont': element_key, 'cont': element_key,
'output': '62', 'output': '62',
} }
stream_response = httpx.get('https://mediapolisvod.rai.it/relinker/relinkerServlet.htm', params=params, headers=get_headers(), timeout=MAX_TIMEOUT) stream_response = httpx.get('https://mediapolisvod.rai.it/relinker/relinkerServlet.htm', params=params, headers=get_headers(), timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
if stream_response.status_code != 200: if stream_response.status_code != 200:
return f"Error: Failed to fetch stream URL (Status: {stream_response.status_code})" return f"Error: Failed to fetch stream URL (Status: {stream_response.status_code})"

View File

@ -17,7 +17,7 @@ from StreamingCommunity.Util.headers import get_userAgent
# Variable # Variable
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout") MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
class VideoSource: class VideoSource:
STAYONLINE_BASE_URL = "https://stayonline.pro" STAYONLINE_BASE_URL = "https://stayonline.pro"
@ -45,7 +45,7 @@ class VideoSource:
def get_redirect_url(self) -> str: def get_redirect_url(self) -> str:
"""Extract the stayonline redirect URL from the initial page.""" """Extract the stayonline redirect URL from the initial page."""
try: try:
response = httpx.get(self.url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT) response = httpx.get(self.url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
response.raise_for_status() response.raise_for_status()
soup = BeautifulSoup(response.text, "html.parser") soup = BeautifulSoup(response.text, "html.parser")
@ -68,7 +68,7 @@ class VideoSource:
raise ValueError("Redirect URL not set. Call get_redirect_url first.") raise ValueError("Redirect URL not set. Call get_redirect_url first.")
try: try:
response = httpx.get(self.redirect_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT) response = httpx.get(self.redirect_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
response.raise_for_status() response.raise_for_status()
soup = BeautifulSoup(response.text, "html.parser") soup = BeautifulSoup(response.text, "html.parser")
@ -89,7 +89,7 @@ class VideoSource:
self.headers['referer'] = f'{self.STAYONLINE_BASE_URL}/l/{link_id}/' self.headers['referer'] = f'{self.STAYONLINE_BASE_URL}/l/{link_id}/'
data = {'id': link_id, 'ref': ''} data = {'id': link_id, 'ref': ''}
response = httpx.post(f'{self.STAYONLINE_BASE_URL}/ajax/linkView.php', headers=self.headers, data=data, timeout=MAX_TIMEOUT) response = httpx.post(f'{self.STAYONLINE_BASE_URL}/ajax/linkView.php', headers=self.headers, data=data, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
response.raise_for_status() response.raise_for_status()
return response.json()['data']['value'] return response.json()['data']['value']
@ -128,7 +128,8 @@ class VideoSource:
response = httpx.get( response = httpx.get(
f'{self.MIXDROP_BASE_URL}/e/{video_id}', f'{self.MIXDROP_BASE_URL}/e/{video_id}',
headers=self._get_mixdrop_headers(), headers=self._get_mixdrop_headers(),
timeout=MAX_TIMEOUT timeout=MAX_TIMEOUT,
verify=REQUEST_VERIFY
) )
response.raise_for_status() response.raise_for_status()
soup = BeautifulSoup(response.text, "html.parser") soup = BeautifulSoup(response.text, "html.parser")

View File

@ -17,6 +17,7 @@ from StreamingCommunity.Util.headers import get_headers
# Variable # Variable
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout") MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
class VideoSource: class VideoSource:
@ -41,7 +42,7 @@ class VideoSource:
- str: The response content if successful, None otherwise. - str: The response content if successful, None otherwise.
""" """
try: try:
response = requests.get(url, headers=self.headers, timeout=MAX_TIMEOUT, impersonate="chrome110") response = requests.get(url, headers=self.headers, timeout=MAX_TIMEOUT, impersonate="chrome110", verify=REQUEST_VERIFY)
if response.status_code >= 400: if response.status_code >= 400:
logging.error(f"Request failed with status code: {response.status_code}") logging.error(f"Request failed with status code: {response.status_code}")
return None return None

View File

@ -14,7 +14,7 @@ from StreamingCommunity.Util.headers import get_userAgent
# Variable # Variable
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout") MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
class VideoSource: class VideoSource:
def __init__(self, full_url, episode_data, session_id, csrf_token): def __init__(self, full_url, episode_data, session_id, csrf_token):
@ -30,7 +30,8 @@ class VideoSource:
cookies={"sessionId": session_id}, cookies={"sessionId": session_id},
headers={"User-Agent": get_userAgent(), "csrf-token": csrf_token}, headers={"User-Agent": get_userAgent(), "csrf-token": csrf_token},
base_url=full_url, base_url=full_url,
timeout=MAX_TIMEOUT timeout=MAX_TIMEOUT,
verify=REQUEST_VERIFY
) )
def get_playlist(self): def get_playlist(self):

View File

@ -20,6 +20,7 @@ from .Helper.Vixcloud.js_parser import JavaScriptParser
# Variable # Variable
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout") MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
console = Console() console = Console()
@ -57,7 +58,7 @@ class VideoSource:
} }
try: try:
response = httpx.get(f"{self.url}/iframe/{self.media_id}", headers=self.headers, params=params, timeout=MAX_TIMEOUT, proxy=self.proxy) response = httpx.get(f"{self.url}/iframe/{self.media_id}", headers=self.headers, params=params, timeout=MAX_TIMEOUT, proxy=self.proxy, verify=REQUEST_VERIFY)
response.raise_for_status() response.raise_for_status()
# Parse response with BeautifulSoup to get iframe source # Parse response with BeautifulSoup to get iframe source
@ -100,7 +101,7 @@ class VideoSource:
""" """
try: try:
if self.iframe_src is not None: if self.iframe_src is not None:
response = httpx.get(self.iframe_src, headers=self.headers, timeout=MAX_TIMEOUT) response = httpx.get(self.iframe_src, headers=self.headers, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
response.raise_for_status() response.raise_for_status()
# Parse response with BeautifulSoup to get content # Parse response with BeautifulSoup to get content
@ -178,7 +179,7 @@ class VideoSourceAnime(VideoSource):
str: Parsed script content str: Parsed script content
""" """
try: try:
response = httpx.get(f"{self.url}/embed-url/{episode_id}", headers=self.headers, timeout=MAX_TIMEOUT) response = httpx.get(f"{self.url}/embed-url/{episode_id}", headers=self.headers, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
response.raise_for_status() response.raise_for_status()
# Extract and clean embed URL # Extract and clean embed URL
@ -186,7 +187,7 @@ class VideoSourceAnime(VideoSource):
self.iframe_src = embed_url self.iframe_src = embed_url
# Fetch video content using embed URL # Fetch video content using embed URL
video_response = httpx.get(embed_url) video_response = httpx.get(embed_url, verify=REQUEST_VERIFY)
video_response.raise_for_status() video_response.raise_for_status()
# Parse response with BeautifulSoup to get content of the scriot # Parse response with BeautifulSoup to get content of the scriot

View File

@ -110,7 +110,7 @@ class M3U8_Segments:
self.key_base_url = f"{parsed_url.scheme}://{parsed_url.netloc}/" self.key_base_url = f"{parsed_url.scheme}://{parsed_url.netloc}/"
try: try:
client_params = {'headers': {'User-Agent': get_userAgent()}, 'timeout': MAX_TIMEOOUT} client_params = {'headers': {'User-Agent': get_userAgent()}, 'timeout': MAX_TIMEOOUT, 'verify': REQUEST_VERIFY}
response = httpx.get(url=key_uri, **client_params) response = httpx.get(url=key_uri, **client_params)
response.raise_for_status() response.raise_for_status()
@ -158,7 +158,7 @@ class M3U8_Segments:
""" """
if self.is_index_url: if self.is_index_url:
try: try:
client_params = {'headers': {'User-Agent': get_userAgent()}, 'timeout': MAX_TIMEOOUT} client_params = {'headers': {'User-Agent': get_userAgent()}, 'timeout': MAX_TIMEOOUT, 'verify': REQUEST_VERIFY}
response = httpx.get(self.url, **client_params, follow_redirects=True) response = httpx.get(self.url, **client_params, follow_redirects=True)
response.raise_for_status() response.raise_for_status()
@ -202,7 +202,8 @@ class M3U8_Segments:
'headers': {'User-Agent': get_userAgent()}, 'headers': {'User-Agent': get_userAgent()},
'timeout': SEGMENT_MAX_TIMEOUT, 'timeout': SEGMENT_MAX_TIMEOUT,
'follow_redirects': True, 'follow_redirects': True,
'http2': False 'http2': False,
'verify': REQUEST_VERIFY
} }
return httpx.Client(**client_params) return httpx.Client(**client_params)

View File

@ -88,7 +88,7 @@ def MP4_downloader(url: str, path: str, referer: str = None, headers_: dict = No
return None, False return None, False
if GET_ONLY_LINK: if GET_ONLY_LINK:
console.print(f"URL: {url}[/bold red]") console.print(f"[bold red]URL: {url}[/bold red]")
return path, True return path, True
if not (url.lower().startswith('http://') or url.lower().startswith('https://')): if not (url.lower().startswith('http://') or url.lower().startswith('https://')):
@ -115,7 +115,7 @@ def MP4_downloader(url: str, path: str, referer: str = None, headers_: dict = No
os.makedirs(os.path.dirname(path), exist_ok=True) os.makedirs(os.path.dirname(path), exist_ok=True)
try: try:
with httpx.Client() as client: with httpx.Client(verify=REQUEST_VERIFY) as client:
with client.stream("GET", url, headers=headers) as response: with client.stream("GET", url, headers=headers) as response:
response.raise_for_status() response.raise_for_status()
total = int(response.headers.get('content-length', 0)) total = int(response.headers.get('content-length', 0))

View File

@ -31,7 +31,7 @@ async def fetch_github_data(client, url):
url=url, url=url,
headers={'user-agent': get_userAgent()}, headers={'user-agent': get_userAgent()},
timeout=config_manager.get_int("REQUESTS", "timeout"), timeout=config_manager.get_int("REQUESTS", "timeout"),
allow_redirects=True follow_redirects=True
) )
return response.json() return response.json()

View File

@ -140,7 +140,7 @@ class ConfigManager:
console.print(f"[bold cyan]Downloading reference configuration:[/bold cyan] [green]{self.reference_config_url}[/green]") console.print(f"[bold cyan]Downloading reference configuration:[/bold cyan] [green]{self.reference_config_url}[/green]")
try: try:
response = requests.get(self.reference_config_url, timeout=8, headers={'User-Agent': get_userAgent()}) response = requests.get(self.reference_config_url, timeout=8, headers={'User-Agent': get_userAgent()}, verify=self.get_bool('REQUESTS', 'verify'))
if response.status_code == 200: if response.status_code == 200:
with open(self.file_path, 'wb') as f: with open(self.file_path, 'wb') as f:
@ -275,8 +275,8 @@ class ConfigManager:
} }
try: try:
console.print(f"[bold cyan]Retrieving site data from GitHub:[/bold cyan]") console.print("[bold cyan]Retrieving site data from GitHub:[/bold cyan]")
response = requests.get(domains_github_url, timeout=8, headers=headers) response = requests.get(domains_github_url, timeout=8, headers=headers, verify=self.get_bool('REQUESTS', 'verify'))
if response.ok: if response.ok:
self.configSite = response.json() self.configSite = response.json()
@ -344,7 +344,7 @@ class ConfigManager:
try: try:
logging.info(f"Downloading {filename} from {url}...") logging.info(f"Downloading {filename} from {url}...")
console.print(f"[bold cyan]File download:[/bold cyan] {os.path.basename(filename)}") console.print(f"[bold cyan]File download:[/bold cyan] {os.path.basename(filename)}")
response = requests.get(url, timeout=8, headers={'User-Agent': get_userAgent()}) response = requests.get(url, timeout=8, headers={'User-Agent': get_userAgent()}, verify=self.get_bool('REQUESTS', 'verify'))
if response.status_code == 200: if response.status_code == 200:
with open(filename, 'wb') as f: with open(filename, 'wb') as f: