mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
mp4: Fix output already exists
This commit is contained in:
parent
9c84eb665c
commit
762d9947a4
@ -84,7 +84,7 @@ def MP4_downloader(url: str, path: str, referer: str = None, headers_: dict = No
|
|||||||
console.log("[red]Output file already exists.")
|
console.log("[red]Output file already exists.")
|
||||||
if TELEGRAM_BOT:
|
if TELEGRAM_BOT:
|
||||||
bot.send_message(f"Contenuto già scaricato!", None)
|
bot.send_message(f"Contenuto già scaricato!", None)
|
||||||
return 400
|
return None, False
|
||||||
|
|
||||||
if GET_ONLY_LINK:
|
if GET_ONLY_LINK:
|
||||||
return {'path': path, 'url': url}
|
return {'path': path, 'url': url}
|
||||||
@ -92,9 +92,9 @@ def MP4_downloader(url: str, path: str, referer: str = None, headers_: dict = No
|
|||||||
if not (url.lower().startswith('http://') or url.lower().startswith('https://')):
|
if not (url.lower().startswith('http://') or url.lower().startswith('https://')):
|
||||||
logging.error(f"Invalid URL: {url}")
|
logging.error(f"Invalid URL: {url}")
|
||||||
console.print(f"[bold red]Invalid URL: {url}[/bold red]")
|
console.print(f"[bold red]Invalid URL: {url}[/bold red]")
|
||||||
return None
|
return None, False
|
||||||
|
|
||||||
try:
|
# Set headers
|
||||||
headers = {}
|
headers = {}
|
||||||
if referer:
|
if referer:
|
||||||
headers['Referer'] = referer
|
headers['Referer'] = referer
|
||||||
@ -104,11 +104,7 @@ def MP4_downloader(url: str, path: str, referer: str = None, headers_: dict = No
|
|||||||
else:
|
else:
|
||||||
headers['User-Agent'] = get_userAgent()
|
headers['User-Agent'] = get_userAgent()
|
||||||
|
|
||||||
except Exception as header_err:
|
# Set interrupt handler
|
||||||
logging.error(f"Error preparing headers: {header_err}")
|
|
||||||
console.print(f"[bold red]Error preparing headers: {header_err}[/bold red]")
|
|
||||||
return None
|
|
||||||
|
|
||||||
temp_path = f"{path}.temp"
|
temp_path = f"{path}.temp"
|
||||||
interrupt_handler = InterruptHandler()
|
interrupt_handler = InterruptHandler()
|
||||||
original_handler = signal.signal(signal.SIGINT, partial(signal_handler, interrupt_handler=interrupt_handler, original_handler=signal.getsignal(signal.SIGINT)))
|
original_handler = signal.signal(signal.SIGINT, partial(signal_handler, interrupt_handler=interrupt_handler, original_handler=signal.getsignal(signal.SIGINT)))
|
||||||
@ -123,7 +119,7 @@ def MP4_downloader(url: str, path: str, referer: str = None, headers_: dict = No
|
|||||||
|
|
||||||
if total == 0:
|
if total == 0:
|
||||||
console.print("[bold red]No video stream found.[/bold red]")
|
console.print("[bold red]No video stream found.[/bold red]")
|
||||||
return None
|
return None, False
|
||||||
|
|
||||||
progress_bar = tqdm(
|
progress_bar = tqdm(
|
||||||
total=total,
|
total=total,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user