Keychain112 commited on
Commit
091927f
·
verified ·
1 Parent(s): be5c87b

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -10
main.py CHANGED
@@ -56,18 +56,17 @@ async def get_audio(id: str):
56
 
57
  # These extra arguments trick YouTube into seeing a phone browser, not a server
58
  ydl_opts = {
59
- 'format': 'bestaudio/best',
60
- 'quiet': True,
61
- 'noplaylist': True,
62
- 'cachedir': False,
63
- # THE FIX: This forces YouTube to use the iOS/Android player logic
64
- 'extractor_args': {
65
- 'youtube': {
66
- 'player_client': ['ios', 'web'],
67
- 'skip': ['dash', 'hls']
68
- }
69
  }
70
  }
 
71
 
72
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
73
  try:
 
56
 
57
  # These extra arguments trick YouTube into seeing a phone browser, not a server
58
  ydl_opts = {
59
+ 'format': 'bestaudio/best',
60
+ 'nocheckcertificate': True, # This stops the protocol error you're seeing
61
+ 'quiet': True,
62
+ 'no_warnings': True,
63
+ 'extractor_args': {
64
+ 'youtube': {
65
+ 'player_client': ['android'], # Android is often more stable than iOS for this
66
+ 'skip': ['dash', 'hls']
 
 
67
  }
68
  }
69
+ }
70
 
71
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
72
  try: