diff --git a/.gitignore b/.gitignore index d04f503..ebe79fd 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,5 @@ note.txt cmd.txt bot_config.json scripts.json -active_requests.json \ No newline at end of file +active_requests.json +StreamingCommunity/Api/Site/altadefinizione/* diff --git a/StreamingCommunity/Api/Player/supervideo.py b/StreamingCommunity/Api/Player/supervideo.py index 942fe2e..4c893b0 100644 --- a/StreamingCommunity/Api/Player/supervideo.py +++ b/StreamingCommunity/Api/Player/supervideo.py @@ -12,7 +12,7 @@ from bs4 import BeautifulSoup # Internal utilities from StreamingCommunity.Util.config_json import config_manager -from StreamingCommunity.Util.headers import get_userAgent +from StreamingCommunity.Util.headers import get_headers # Variable @@ -27,11 +27,7 @@ class VideoSource: Attributes: - url (str): The URL of the video source. """ - self.headers = { - 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', - 'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7', - 'User-Agent': get_userAgent() - } + self.headers = get_headers() self.client = httpx.Client() self.url = url @@ -66,7 +62,7 @@ class VideoSource: """ iframes = soup.find_all("iframe") if iframes and len(iframes) > 1: - return iframes[1].get("src") + return iframes[0].get("src") or iframes[0].get("data-src") return None @@ -115,13 +111,8 @@ class VideoSource: logging.error("Failed to fetch HTML content.") return None - soup = BeautifulSoup(html_content, "html.parser") - if not soup: - logging.error("Failed to parse HTML content.") - return None - # Find master playlist - data_js = self.get_result_node_js(soup) + data_js = self.get_result_node_js(BeautifulSoup(html_content, "html.parser")) if data_js is not None: match = re.search(r'sources:\s*\[\{\s*file:\s*"([^"]+)"', data_js) @@ -131,7 +122,7 @@ class VideoSource: else: - iframe_src = self.get_iframe(soup) + iframe_src = self.get_iframe(BeautifulSoup(html_content, "html.parser")) if not iframe_src: logging.error("No iframe found.") return None diff --git a/StreamingCommunity/Api/Site/1337xx/site.py b/StreamingCommunity/Api/Site/1337xx/site.py index 06c8d22..7d0284c 100644 --- a/StreamingCommunity/Api/Site/1337xx/site.py +++ b/StreamingCommunity/Api/Site/1337xx/site.py @@ -41,7 +41,7 @@ def title_search(word_to_search: str) -> int: table_show_manager.clear() # Check if domain is working - domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) + domain_to_use, base_url = search_domain(site_constant.FULL_URL) if domain_to_use is None or base_url is None: console.log("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") diff --git a/StreamingCommunity/Api/Site/animeunity/site.py b/StreamingCommunity/Api/Site/animeunity/site.py index 564e7b8..20ba0ef 100644 --- a/StreamingCommunity/Api/Site/animeunity/site.py +++ b/StreamingCommunity/Api/Site/animeunity/site.py @@ -111,7 +111,7 @@ def title_search(title: str) -> int: table_show_manager.clear() # Check if domain is working - domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) + domain_to_use, base_url = search_domain(site_constant.FULL_URL) if domain_to_use is None or base_url is None: console.print("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") diff --git a/StreamingCommunity/Api/Site/cb01new/site.py b/StreamingCommunity/Api/Site/cb01new/site.py index fa5226e..b1658ae 100644 --- a/StreamingCommunity/Api/Site/cb01new/site.py +++ b/StreamingCommunity/Api/Site/cb01new/site.py @@ -42,7 +42,7 @@ def title_search(word_to_search: str) -> int: table_show_manager.clear() # Check if domain is working - domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) + domain_to_use, base_url = search_domain(site_constant.FULL_URL) if domain_to_use is None or base_url is None: console.print("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") diff --git a/StreamingCommunity/Api/Site/ddlstreamitaly/site.py b/StreamingCommunity/Api/Site/ddlstreamitaly/site.py index ee46a19..fe4d69a 100644 --- a/StreamingCommunity/Api/Site/ddlstreamitaly/site.py +++ b/StreamingCommunity/Api/Site/ddlstreamitaly/site.py @@ -43,7 +43,7 @@ def title_search(word_to_search: str) -> int: table_show_manager.clear() # Check if domain is working - domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) + domain_to_use, base_url = search_domain(site_constant.FULL_URL) if domain_to_use is None or base_url is None: console.print("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") diff --git a/StreamingCommunity/Api/Site/guardaserie/site.py b/StreamingCommunity/Api/Site/guardaserie/site.py index 47d68b9..b2441a7 100644 --- a/StreamingCommunity/Api/Site/guardaserie/site.py +++ b/StreamingCommunity/Api/Site/guardaserie/site.py @@ -42,7 +42,7 @@ def title_search(word_to_search: str) -> int: table_show_manager.clear() # Check if domain is working - domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) + domain_to_use, base_url = search_domain(site_constant.FULL_URL) if domain_to_use is None or base_url is None: console.print("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") diff --git a/StreamingCommunity/Api/Site/streamingcommunity/site.py b/StreamingCommunity/Api/Site/streamingcommunity/site.py index dbdea32..dd38e86 100644 --- a/StreamingCommunity/Api/Site/streamingcommunity/site.py +++ b/StreamingCommunity/Api/Site/streamingcommunity/site.py @@ -38,7 +38,7 @@ def title_search(title_search: str) -> int: Returns: int: The number of titles found. """ - domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) + domain_to_use, base_url = search_domain(site_constant.FULL_URL) if domain_to_use is None or base_url is None: console.print("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") diff --git a/StreamingCommunity/Api/Template/Util/get_domain.py b/StreamingCommunity/Api/Template/Util/get_domain.py index a004ac4..52db475 100644 --- a/StreamingCommunity/Api/Template/Util/get_domain.py +++ b/StreamingCommunity/Api/Template/Util/get_domain.py @@ -67,7 +67,8 @@ def validate_url(url, base_url): return False, None client = httpx.Client( - verify=VERIFY, + http1=True, + verify=certifi.where(), headers=get_headers(), timeout=MAX_TIMEOUT ) @@ -82,7 +83,7 @@ def validate_url(url, base_url): return True, base_domain -def search_domain(site_name: str, base_url: str, get_first: bool = False): +def search_domain(base_url: str): """Search for valid domain matching site name and base URL.""" try: is_correct, redirect_tld = validate_url(base_url, base_url) diff --git a/StreamingCommunity/Upload/version.py b/StreamingCommunity/Upload/version.py index ccd8370..ea1d870 100644 --- a/StreamingCommunity/Upload/version.py +++ b/StreamingCommunity/Upload/version.py @@ -1,5 +1,5 @@ __title__ = 'StreamingCommunity' -__version__ = '2.9.0' +__version__ = '2.9.1' __author__ = 'Arrowar' __description__ = 'A command-line program to download film' __copyright__ = 'Copyright 2024' diff --git a/setup.py b/setup.py index 9035c0d..7bd72ad 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ with open("requirements.txt", "r", encoding="utf-8-sig") as f: setup( name="StreamingCommunity", - version="2.9.0", + version="2.9.1", long_description=read_readme(), long_description_content_type="text/markdown", author="Lovi-0",