mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
mp4: Fix error 'set_alpn_protocols'
(cherry picked from commit ab094d0b1db21e74b8af4b5b995779dfd88ce3db)
This commit is contained in:
parent
587db0cd0b
commit
47c12dbb15
@ -31,7 +31,6 @@ from ...FFmpeg import print_duration_table
|
|||||||
|
|
||||||
# Config
|
# Config
|
||||||
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
|
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
|
||||||
REQUEST_HTTP2 = config_manager.get_bool('REQUESTS', 'http2')
|
|
||||||
GET_ONLY_LINK = config_manager.get_bool('M3U8_PARSER', 'get_only_link')
|
GET_ONLY_LINK = config_manager.get_bool('M3U8_PARSER', 'get_only_link')
|
||||||
REQUEST_TIMEOUT = config_manager.get_float('REQUESTS', 'timeout')
|
REQUEST_TIMEOUT = config_manager.get_float('REQUESTS', 'timeout')
|
||||||
TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot')
|
TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot')
|
||||||
@ -111,11 +110,12 @@ def MP4_downloader(url: str, path: str, referer: str = None, headers_: dict = No
|
|||||||
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)))
|
||||||
|
|
||||||
try:
|
# Ensure the output directory exists
|
||||||
transport = httpx.HTTPTransport(verify=REQUEST_VERIFY, http2=REQUEST_HTTP2)
|
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||||
|
|
||||||
with httpx.Client(transport=transport, timeout=httpx.Timeout(60)) as client:
|
try:
|
||||||
with client.stream("GET", url, headers=headers, timeout=REQUEST_TIMEOUT) as response:
|
with httpx.Client() as client:
|
||||||
|
with client.stream("GET", url, headers=headers) as response:
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
total = int(response.headers.get('content-length', 0))
|
total = int(response.headers.get('content-length', 0))
|
||||||
|
|
||||||
@ -123,6 +123,7 @@ def MP4_downloader(url: str, path: str, referer: str = None, headers_: dict = No
|
|||||||
console.print("[bold red]No video stream found.[/bold red]")
|
console.print("[bold red]No video stream found.[/bold red]")
|
||||||
return None, False
|
return None, False
|
||||||
|
|
||||||
|
# Create a fancy progress bar
|
||||||
progress_bar = tqdm(
|
progress_bar = tqdm(
|
||||||
total=total,
|
total=total,
|
||||||
ascii='░▒█',
|
ascii='░▒█',
|
||||||
|
@ -257,13 +257,6 @@ class ConfigManager:
|
|||||||
for site, info in examples:
|
for site, info in examples:
|
||||||
sites_info.append(f"[cyan]{site}[/cyan]: {info.get('full_url', 'N/A')}")
|
sites_info.append(f"[cyan]{site}[/cyan]: {info.get('full_url', 'N/A')}")
|
||||||
|
|
||||||
console.print("[bold cyan]Sample sites:[/bold cyan]")
|
|
||||||
for info in sites_info:
|
|
||||||
console.print(f" {info}")
|
|
||||||
|
|
||||||
if site_count > 3:
|
|
||||||
console.print(f" ... and {site_count - 3} more")
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
console.print("[bold yellow]API returned empty data set[/bold yellow]")
|
console.print("[bold yellow]API returned empty data set[/bold yellow]")
|
||||||
else:
|
else:
|
||||||
|
@ -10,6 +10,8 @@ sys.path.append(src_path)
|
|||||||
|
|
||||||
# Import
|
# Import
|
||||||
from StreamingCommunity.Util.message import start_message
|
from StreamingCommunity.Util.message import start_message
|
||||||
|
from StreamingCommunity.Util.os import os_summary
|
||||||
|
os_summary.get_system_summary()
|
||||||
from StreamingCommunity.Util.logger import Logger
|
from StreamingCommunity.Util.logger import Logger
|
||||||
from StreamingCommunity.Lib.Downloader import MP4_downloader
|
from StreamingCommunity.Lib.Downloader import MP4_downloader
|
||||||
|
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
"REQUESTS": {
|
"REQUESTS": {
|
||||||
"verify": false,
|
"verify": false,
|
||||||
"timeout": 20,
|
"timeout": 20,
|
||||||
"max_retry": 8,
|
"max_retry": 8
|
||||||
"http2": true
|
|
||||||
},
|
},
|
||||||
"M3U8_DOWNLOAD": {
|
"M3U8_DOWNLOAD": {
|
||||||
"tqdm_delay": 0.01,
|
"tqdm_delay": 0.01,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user