Maximo Fernandez
commited on
Commit
·
ad33eea
1
Parent(s):
155317d
user agent
Browse files- download.py +8 -0
download.py
CHANGED
|
@@ -72,6 +72,10 @@ def download_youtube_video(url):
|
|
| 72 |
ydl_options = {
|
| 73 |
"outtmpl": f"{VIDEO_FOLDER}/{DOWNLOAD_VIDEO_NAME}.{DOWNLOAD_VIDEO_FORMAT}",
|
| 74 |
"format": "best",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
}
|
| 76 |
# Download video
|
| 77 |
with yt_dlp.YoutubeDL(ydl_options) as ydl:
|
|
@@ -85,6 +89,10 @@ def download_youtube_audio(url):
|
|
| 85 |
ydl_options = {
|
| 86 |
"outtmpl": f"{AUDIO_FOLDER}/{DOWNLOAD_AUDIO_NAME}.{DOWNLOAD_AUDIO_FORMAT}",
|
| 87 |
"format": "bestaudio",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
}
|
| 89 |
# Download audio
|
| 90 |
with yt_dlp.YoutubeDL(ydl_options) as ydl:
|
|
|
|
| 72 |
ydl_options = {
|
| 73 |
"outtmpl": f"{VIDEO_FOLDER}/{DOWNLOAD_VIDEO_NAME}.{DOWNLOAD_VIDEO_FORMAT}",
|
| 74 |
"format": "best",
|
| 75 |
+
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
| 76 |
+
"force_ipv4": True,
|
| 77 |
+
"no_check_certificates": True,
|
| 78 |
+
"geo_bypass": True,
|
| 79 |
}
|
| 80 |
# Download video
|
| 81 |
with yt_dlp.YoutubeDL(ydl_options) as ydl:
|
|
|
|
| 89 |
ydl_options = {
|
| 90 |
"outtmpl": f"{AUDIO_FOLDER}/{DOWNLOAD_AUDIO_NAME}.{DOWNLOAD_AUDIO_FORMAT}",
|
| 91 |
"format": "bestaudio",
|
| 92 |
+
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
| 93 |
+
"force_ipv4": True,
|
| 94 |
+
"no_check_certificates": True,
|
| 95 |
+
"geo_bypass": True,
|
| 96 |
}
|
| 97 |
# Download audio
|
| 98 |
with yt_dlp.YoutubeDL(ydl_options) as ydl:
|