Spaces:
Sleeping
Sleeping
Update main.py
Browse files
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 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
'
|
| 65 |
-
'
|
| 66 |
-
|
| 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:
|