Fix: Strict HLS exclusion and force progressive HTTPS streams (v7 cache)
This commit is contained in:
parent
bc83f145fe
commit
56a3e24b1a
1 changed files with 6 additions and 3 deletions
|
|
@ -609,7 +609,7 @@ async def stream_audio(id: str):
|
||||||
try:
|
try:
|
||||||
# Check Cache for stream URL
|
# Check Cache for stream URL
|
||||||
# Check Cache for stream URL
|
# Check Cache for stream URL
|
||||||
cache_key = f"v6:stream:{id}" # v6 cache key for ios client / relaxed format
|
cache_key = f"v7:stream:{id}" # v7 cache key - force purge for HLS fix
|
||||||
cached_data = cache.get(cache_key)
|
cached_data = cache.get(cache_key)
|
||||||
|
|
||||||
stream_url = None
|
stream_url = None
|
||||||
|
|
@ -627,7 +627,9 @@ async def stream_audio(id: str):
|
||||||
print(f"DEBUG: Fetching new stream URL for '{id}'")
|
print(f"DEBUG: Fetching new stream URL for '{id}'")
|
||||||
url = f"https://www.youtube.com/watch?v={id}"
|
url = f"https://www.youtube.com/watch?v={id}"
|
||||||
ydl_opts = {
|
ydl_opts = {
|
||||||
'format': 'bestaudio[ext=m4a]/bestaudio/best', # Relaxed format to prevent "Requested format not available"
|
# CRITICAL: protocol=https forces progressive HTTP streams, NOT HLS manifests
|
||||||
|
# HLS (.m3u8) streams cannot be played by browser <audio> elements
|
||||||
|
'format': 'bestaudio[ext=m4a][protocol=https]/bestaudio[protocol=https]/bestaudio[ext=m4a]/bestaudio/best',
|
||||||
'quiet': True,
|
'quiet': True,
|
||||||
'noplaylist': True,
|
'noplaylist': True,
|
||||||
'nocheckcertificate': True,
|
'nocheckcertificate': True,
|
||||||
|
|
@ -635,7 +637,8 @@ async def stream_audio(id: str):
|
||||||
'socket_timeout': 30,
|
'socket_timeout': 30,
|
||||||
'retries': 3,
|
'retries': 3,
|
||||||
'force_ipv4': True,
|
'force_ipv4': True,
|
||||||
'extractor_args': {'youtube': {'player_client': ['ios']}}, # iOS is currently most stable without PO Token
|
# Use web_creator client which provides progressive streams
|
||||||
|
'extractor_args': {'youtube': {'player_client': ['web_creator', 'mweb', 'web']}},
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue