From 394f937fcbd6008a7466c7645fd72ab691cfa7ee Mon Sep 17 00:00:00 2001 From: tcely Date: Fri, 20 Dec 2024 10:07:24 -0500 Subject: [PATCH] Handle raise_no_formats exception Catching this and checking the message may be the best way to skip members only videos. --- tubesync/sync/youtube.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tubesync/sync/youtube.py b/tubesync/sync/youtube.py index d51c7b45..33cdb795 100644 --- a/tubesync/sync/youtube.py +++ b/tubesync/sync/youtube.py @@ -83,6 +83,7 @@ def get_media_info(url): ''' opts = get_yt_opts() opts.update({ + 'ignore_no_formats_error': False, 'skip_download': True, 'forcejson': True, 'simulate': True, @@ -93,6 +94,11 @@ def get_media_info(url): with yt_dlp.YoutubeDL(opts) as y: try: 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: raise YouTubeError(f'Failed to extract_info for "{url}": {e}') from e if not response: