mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-05 02:55:25 +00:00
Bump v2.9.1
This commit is contained in:
parent
762d9947a4
commit
6ce30c90e5
3
.gitignore
vendored
3
.gitignore
vendored
@ -47,4 +47,5 @@ note.txt
|
||||
cmd.txt
|
||||
bot_config.json
|
||||
scripts.json
|
||||
active_requests.json
|
||||
active_requests.json
|
||||
StreamingCommunity/Api/Site/altadefinizione/*
|
||||
|
@ -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
|
||||
|
@ -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]")
|
||||
|
@ -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]")
|
||||
|
@ -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]")
|
||||
|
@ -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]")
|
||||
|
@ -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]")
|
||||
|
@ -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]")
|
||||
|
@ -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)
|
||||
|
@ -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'
|
||||
|
Loading…
x
Reference in New Issue
Block a user