mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-10 01:10:31 +00:00
handle download error
This commit is contained in:
parent
a7d9b4584b
commit
33f27f018f
@ -4,8 +4,6 @@ functionality:
|
||||
- handle yt-dlp errors
|
||||
"""
|
||||
|
||||
from time import sleep
|
||||
|
||||
import yt_dlp
|
||||
|
||||
|
||||
@ -30,14 +28,14 @@ class YtWrap:
|
||||
|
||||
def download(self, url):
|
||||
"""make download request"""
|
||||
|
||||
with yt_dlp.YoutubeDL(self.obs) as ydl:
|
||||
try:
|
||||
ydl.download([url])
|
||||
except yt_dlp.utils.DownloadError:
|
||||
print(f"{url}: failed to download, retry...")
|
||||
sleep(3)
|
||||
ydl.download([url])
|
||||
print(f"{url}: failed to download.")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def extract(self, url):
|
||||
"""make extract request"""
|
||||
|
Loading…
Reference in New Issue
Block a user