Spaces:
Running
on
Zero
Running
on
Zero
Using cookies to work in HF see [YT_Dlp FAQ](https://github.com/yt-dlp/yt-dlp/wiki/FAQ) to how to get cookies
Browse files- src/main.py +2 -1
src/main.py
CHANGED
@@ -64,7 +64,7 @@ def get_youtube_video_id(url, ignore_playlist=True):
|
|
64 |
return None
|
65 |
|
66 |
|
67 |
-
def yt_download(link):
|
68 |
ydl_opts = {
|
69 |
'format': 'bestaudio',
|
70 |
'outtmpl': '%(title)s',
|
@@ -73,6 +73,7 @@ def yt_download(link):
|
|
73 |
'no_warnings': True,
|
74 |
'quiet': True,
|
75 |
'extractaudio': True,
|
|
|
76 |
'postprocessors': [{'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3'}],
|
77 |
}
|
78 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
|
|
64 |
return None
|
65 |
|
66 |
|
67 |
+
def yt_download(link,cookies):
|
68 |
ydl_opts = {
|
69 |
'format': 'bestaudio',
|
70 |
'outtmpl': '%(title)s',
|
|
|
73 |
'no_warnings': True,
|
74 |
'quiet': True,
|
75 |
'extractaudio': True,
|
76 |
+
'cookiefile': f'{cookies}'
|
77 |
'postprocessors': [{'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3'}],
|
78 |
}
|
79 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|