mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
Add domain ...
This commit is contained in:
parent
2b2317705b
commit
f3090c330c
@ -45,7 +45,8 @@ class GetSerieInfo:
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
# Make an HTTP request to the series URL
|
# Make an HTTP request to the series URL
|
||||||
response = httpx.get(self.url, headers=self.headers)
|
print(self.url)
|
||||||
|
response = httpx.get(self.url, headers=self.headers, timeout=10)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
# Parse HTML content of the page
|
# Parse HTML content of the page
|
||||||
|
@ -62,6 +62,7 @@ def donwload_video(scape_info_serie: GetSerieInfo, index_season_selected: int, i
|
|||||||
output_filename = os.path.join(mp4_path, mp4_name)
|
output_filename = os.path.join(mp4_path, mp4_name)
|
||||||
).start()
|
).start()
|
||||||
|
|
||||||
|
|
||||||
def donwload_episode(scape_info_serie: GetSerieInfo, index_season_selected: int, donwload_all: bool = False) -> None:
|
def donwload_episode(scape_info_serie: GetSerieInfo, index_season_selected: int, donwload_all: bool = False) -> None:
|
||||||
"""
|
"""
|
||||||
Download all episodes of a season.
|
Download all episodes of a season.
|
||||||
@ -101,7 +102,6 @@ def donwload_episode(scape_info_serie: GetSerieInfo, index_season_selected: int,
|
|||||||
donwload_video(scape_info_serie, index_season_selected, i_episode)
|
donwload_video(scape_info_serie, index_season_selected, i_episode)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def download_series(dict_serie: MediaItem) -> None:
|
def download_series(dict_serie: MediaItem) -> None:
|
||||||
|
|
||||||
# Start message and set up video source
|
# Start message and set up video source
|
||||||
|
@ -28,7 +28,9 @@ table_show_manager = TVShowManager()
|
|||||||
|
|
||||||
|
|
||||||
# Config
|
# Config
|
||||||
|
SITE_NAME = "guardaserie"
|
||||||
ROOT_PATH = config_manager.get('DEFAULT', 'root_path')
|
ROOT_PATH = config_manager.get('DEFAULT', 'root_path')
|
||||||
|
DOMAIN_NOW = config_manager.get('SITE', SITE_NAME)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +40,7 @@ def title_search(word_to_search) -> int:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Send request to search for titles
|
# Send request to search for titles
|
||||||
response = httpx.get(f"https://guardaserie.ceo/?story={word_to_search}&do=search&subaction=search", headers={'user-agent': get_headers()})
|
response = httpx.get(f"https://guardaserie.{DOMAIN_NOW}/?story={word_to_search}&do=search&subaction=search", headers={'user-agent': get_headers()})
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
# Create soup and find table
|
# Create soup and find table
|
||||||
|
@ -31,44 +31,47 @@ REQUEST_TIMEOUT = config_manager.get_float('REQUESTS', 'timeout')
|
|||||||
|
|
||||||
def MP4_downloader(url: str, path: str, referer: str, add_desc: str):
|
def MP4_downloader(url: str, path: str, referer: str, add_desc: str):
|
||||||
|
|
||||||
if not os.path.exists(path):
|
|
||||||
console.log("[cyan]Video [red]already exists.")
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
# Make request to get content of video
|
# Make request to get content of video
|
||||||
logging.info(f"Make request to fetch mp4 from: {url}")
|
logging.info(f"Make request to fetch mp4 from: {url}")
|
||||||
response = httpx.get(url, stream=True, headers={'Referer': referer, 'user-agent': get_headers()}, verify=REQUEST_VERIFY, timeout=REQUEST_TIMEOUT)
|
headers = {'Referer': referer, 'user-agent': get_headers()}
|
||||||
total = int(response.headers.get('content-length', 0))
|
|
||||||
|
with httpx.Client(verify=REQUEST_VERIFY, timeout=REQUEST_TIMEOUT) as client:
|
||||||
|
with client.stream("GET", url, headers=headers) as response:
|
||||||
|
total = int(response.headers.get('content-length', 0))
|
||||||
|
|
||||||
|
# Create bar format
|
||||||
|
if TQDM_USE_LARGE_BAR:
|
||||||
|
bar_format = (f"{Colors.YELLOW}Downloading {Colors.WHITE}({add_desc}{Colors.WHITE}): "
|
||||||
|
f"{Colors.RED}{{percentage:.2f}}% {Colors.MAGENTA}{{bar}} {Colors.WHITE}[ "
|
||||||
|
f"{Colors.YELLOW}{{n_fmt}}{Colors.WHITE} / {Colors.RED}{{total_fmt}} {Colors.WHITE}] "
|
||||||
|
f"{Colors.YELLOW}{{elapsed}} {Colors.WHITE}< {Colors.CYAN}{{remaining}} {Colors.WHITE}| "
|
||||||
|
f"{Colors.YELLOW}{{rate_fmt}}{{postfix}} {Colors.WHITE}]")
|
||||||
|
else:
|
||||||
|
bar_format = (f"{Colors.YELLOW}Proc{Colors.WHITE}: {Colors.RED}{{percentage:.2f}}% "
|
||||||
|
f"{Colors.WHITE}| {Colors.CYAN}{{remaining}}{{postfix}} {Colors.WHITE}]")
|
||||||
|
|
||||||
# Create bar format
|
# Create progress bar
|
||||||
if TQDM_USE_LARGE_BAR:
|
progress_bar = tqdm(
|
||||||
bar_format=f"{Colors.YELLOW}Downloading {Colors.WHITE}({add_desc}{Colors.WHITE}): {Colors.RED}{{percentage:.2f}}% {Colors.MAGENTA}{{bar}} {Colors.WHITE}[ {Colors.YELLOW}{{n_fmt}}{Colors.WHITE} / {Colors.RED}{{total_fmt}} {Colors.WHITE}] {Colors.YELLOW}{{elapsed}} {Colors.WHITE}< {Colors.CYAN}{{remaining}} {Colors.WHITE}| {Colors.YELLOW}{{rate_fmt}}{{postfix}} {Colors.WHITE}]"
|
total=total,
|
||||||
else:
|
unit='iB',
|
||||||
bar_format=f"{Colors.YELLOW}Proc{Colors.WHITE}: {Colors.RED}{{percentage:.2f}}% {Colors.WHITE}| {Colors.CYAN}{{remaining}}{{postfix}} {Colors.WHITE}]"
|
ascii='░▒█',
|
||||||
|
bar_format=bar_format,
|
||||||
# Create progress bar
|
unit_scale=True,
|
||||||
progress_bar = tqdm(
|
unit_divisor=1024
|
||||||
total=total,
|
)
|
||||||
unit='iB',
|
|
||||||
ascii='░▒█',
|
|
||||||
bar_format=bar_format,
|
|
||||||
unit_scale=True,
|
|
||||||
unit_divisor=1024
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# Download file
|
|
||||||
with open(path, 'wb') as file, progress_bar as bar:
|
|
||||||
for data in response.iter_content(chunk_size=1024):
|
|
||||||
size = file.write(data)
|
|
||||||
bar.update(size)
|
|
||||||
|
|
||||||
|
# Download file
|
||||||
|
with open(path, 'wb') as file, progress_bar as bar:
|
||||||
|
for chunk in response.iter_bytes(chunk_size=1024):
|
||||||
|
if chunk:
|
||||||
|
size = file.write(chunk)
|
||||||
|
bar.update(size)
|
||||||
|
|
||||||
# Get summary
|
# Get summary
|
||||||
console.print(Panel(
|
console.print(Panel(
|
||||||
f"[bold green]Download completed![/bold green]\n"
|
f"[bold green]Download completed![/bold green]\n"
|
||||||
f"File size: [bold red]{format_size(os.path.getsize(path))}[/bold red]\n"
|
f"File size: [bold red]{format_size(os.path.getsize(path))}[/bold red]\n"
|
||||||
f"Duration: [bold]{print_duration_table(path, show=False)}[/bold]",
|
f"Duration: [bold]{print_duration_table(path, show=False)}[/bold]",
|
||||||
title=f"{os.path.basename(path.replace('.mp4', ''))}", border_style="green"))
|
title=f"{os.path.basename(path.replace('.mp4', ''))}",
|
||||||
|
border_style="green"
|
||||||
|
))
|
@ -45,6 +45,7 @@
|
|||||||
"SITE": {
|
"SITE": {
|
||||||
"streamingcommunity": "foo",
|
"streamingcommunity": "foo",
|
||||||
"animeunity": "to",
|
"animeunity": "to",
|
||||||
"altadefinizione": "vodka"
|
"altadefinizione": "vodka",
|
||||||
|
"guardaserie": "ceo"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user