mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 03:55:24 +00:00
Bump v2.9.1
This commit is contained in:
parent
762d9947a4
commit
6ce30c90e5
1
.gitignore
vendored
1
.gitignore
vendored
@ -48,3 +48,4 @@ cmd.txt
|
|||||||
bot_config.json
|
bot_config.json
|
||||||
scripts.json
|
scripts.json
|
||||||
active_requests.json
|
active_requests.json
|
||||||
|
StreamingCommunity/Api/Site/altadefinizione/*
|
||||||
|
@ -12,7 +12,7 @@ from bs4 import BeautifulSoup
|
|||||||
|
|
||||||
# Internal utilities
|
# Internal utilities
|
||||||
from StreamingCommunity.Util.config_json import config_manager
|
from StreamingCommunity.Util.config_json import config_manager
|
||||||
from StreamingCommunity.Util.headers import get_userAgent
|
from StreamingCommunity.Util.headers import get_headers
|
||||||
|
|
||||||
|
|
||||||
# Variable
|
# Variable
|
||||||
@ -27,11 +27,7 @@ class VideoSource:
|
|||||||
Attributes:
|
Attributes:
|
||||||
- url (str): The URL of the video source.
|
- url (str): The URL of the video source.
|
||||||
"""
|
"""
|
||||||
self.headers = {
|
self.headers = get_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.client = httpx.Client()
|
self.client = httpx.Client()
|
||||||
self.url = url
|
self.url = url
|
||||||
|
|
||||||
@ -66,7 +62,7 @@ class VideoSource:
|
|||||||
"""
|
"""
|
||||||
iframes = soup.find_all("iframe")
|
iframes = soup.find_all("iframe")
|
||||||
if iframes and len(iframes) > 1:
|
if iframes and len(iframes) > 1:
|
||||||
return iframes[1].get("src")
|
return iframes[0].get("src") or iframes[0].get("data-src")
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -115,13 +111,8 @@ class VideoSource:
|
|||||||
logging.error("Failed to fetch HTML content.")
|
logging.error("Failed to fetch HTML content.")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
soup = BeautifulSoup(html_content, "html.parser")
|
|
||||||
if not soup:
|
|
||||||
logging.error("Failed to parse HTML content.")
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Find master playlist
|
# 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:
|
if data_js is not None:
|
||||||
match = re.search(r'sources:\s*\[\{\s*file:\s*"([^"]+)"', data_js)
|
match = re.search(r'sources:\s*\[\{\s*file:\s*"([^"]+)"', data_js)
|
||||||
@ -131,7 +122,7 @@ class VideoSource:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
iframe_src = self.get_iframe(soup)
|
iframe_src = self.get_iframe(BeautifulSoup(html_content, "html.parser"))
|
||||||
if not iframe_src:
|
if not iframe_src:
|
||||||
logging.error("No iframe found.")
|
logging.error("No iframe found.")
|
||||||
return None
|
return None
|
||||||
|
@ -41,7 +41,7 @@ def title_search(word_to_search: str) -> int:
|
|||||||
table_show_manager.clear()
|
table_show_manager.clear()
|
||||||
|
|
||||||
# Check if domain is working
|
# 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:
|
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]")
|
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()
|
table_show_manager.clear()
|
||||||
|
|
||||||
# Check if domain is working
|
# 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:
|
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]")
|
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()
|
table_show_manager.clear()
|
||||||
|
|
||||||
# Check if domain is working
|
# 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:
|
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]")
|
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()
|
table_show_manager.clear()
|
||||||
|
|
||||||
# Check if domain is working
|
# 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:
|
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]")
|
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()
|
table_show_manager.clear()
|
||||||
|
|
||||||
# Check if domain is working
|
# 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:
|
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]")
|
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:
|
Returns:
|
||||||
int: The number of titles found.
|
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:
|
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]")
|
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
|
return False, None
|
||||||
|
|
||||||
client = httpx.Client(
|
client = httpx.Client(
|
||||||
verify=VERIFY,
|
http1=True,
|
||||||
|
verify=certifi.where(),
|
||||||
headers=get_headers(),
|
headers=get_headers(),
|
||||||
timeout=MAX_TIMEOUT
|
timeout=MAX_TIMEOUT
|
||||||
)
|
)
|
||||||
@ -82,7 +83,7 @@ def validate_url(url, base_url):
|
|||||||
|
|
||||||
return True, base_domain
|
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."""
|
"""Search for valid domain matching site name and base URL."""
|
||||||
try:
|
try:
|
||||||
is_correct, redirect_tld = validate_url(base_url, base_url)
|
is_correct, redirect_tld = validate_url(base_url, base_url)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
__title__ = 'StreamingCommunity'
|
__title__ = 'StreamingCommunity'
|
||||||
__version__ = '2.9.0'
|
__version__ = '2.9.1'
|
||||||
__author__ = 'Arrowar'
|
__author__ = 'Arrowar'
|
||||||
__description__ = 'A command-line program to download film'
|
__description__ = 'A command-line program to download film'
|
||||||
__copyright__ = 'Copyright 2024'
|
__copyright__ = 'Copyright 2024'
|
||||||
|
2
setup.py
2
setup.py
@ -10,7 +10,7 @@ with open("requirements.txt", "r", encoding="utf-8-sig") as f:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="StreamingCommunity",
|
name="StreamingCommunity",
|
||||||
version="2.9.0",
|
version="2.9.1",
|
||||||
long_description=read_readme(),
|
long_description=read_readme(),
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
author="Lovi-0",
|
author="Lovi-0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user