Add an explicit message when video does not exists for extract_info.
This commit is contained in:
parent
94ddbeef21
commit
7302cb4df6
|
|
@ -482,18 +482,25 @@ class DownloadManager:
|
|||
'cookiefile' : f'cookies/{request_id}.txt' if request_id is not None else None
|
||||
}
|
||||
|
||||
failed = False
|
||||
|
||||
try:
|
||||
with ydl.YoutubeDL(ydl_opts) as dl:
|
||||
info = dl.extract_info(url, download=False)
|
||||
except http.cookiejar.LoadError as error:
|
||||
return str(error), True
|
||||
|
||||
if info is None :
|
||||
info = "Video unavailable"
|
||||
failed = True
|
||||
except Exception as error:
|
||||
info = str(error)
|
||||
failed = True
|
||||
|
||||
try:
|
||||
os.remove(f'cookies/{request_id}.txt')
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
return info, False
|
||||
return info, failed
|
||||
|
||||
def get_api_status_code(self):
|
||||
# Some presets were not found
|
||||
|
|
|
|||
|
|
@ -60,5 +60,5 @@ ignoreerrors = false
|
|||
[site:YOUTUBE]
|
||||
_hosts = music.youtube.com,www.youtube.com,youtu.be
|
||||
_video_indicators = /watch?
|
||||
_playlist_indicators = ?list=,&list=,/user/,/playlists,/videos,/featured
|
||||
_playlist_indicators = ?list=,&list=,/user/,/playlists,/videos,/featured,/channel
|
||||
_site = KNOWN
|
||||
|
|
|
|||
Loading…
Reference in New Issue