mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-25 14:36:34 +00:00
Handle raise_no_formats exception
Catching this and checking the message may be the best way to skip members only videos.
This commit is contained in:
parent
52865cb5b4
commit
394f937fcb
@ -83,6 +83,7 @@ def get_media_info(url):
|
|||||||
'''
|
'''
|
||||||
opts = get_yt_opts()
|
opts = get_yt_opts()
|
||||||
opts.update({
|
opts.update({
|
||||||
|
'ignore_no_formats_error': False,
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
'forcejson': True,
|
'forcejson': True,
|
||||||
'simulate': True,
|
'simulate': True,
|
||||||
@ -93,6 +94,11 @@ def get_media_info(url):
|
|||||||
with yt_dlp.YoutubeDL(opts) as y:
|
with yt_dlp.YoutubeDL(opts) as y:
|
||||||
try:
|
try:
|
||||||
response = y.extract_info(url, download=False)
|
response = y.extract_info(url, download=False)
|
||||||
|
except yt_dlp.utils.ExtractorError as e:
|
||||||
|
if not e.expected:
|
||||||
|
raise e
|
||||||
|
log.warn(e.msg)
|
||||||
|
pass
|
||||||
except yt_dlp.utils.DownloadError as e:
|
except yt_dlp.utils.DownloadError as e:
|
||||||
raise YouTubeError(f'Failed to extract_info for "{url}": {e}') from e
|
raise YouTubeError(f'Failed to extract_info for "{url}": {e}') from e
|
||||||
if not response:
|
if not response:
|
||||||
|
Loading…
Reference in New Issue
Block a user