From a38392a1a2706771929bb91485399dfe0cd36dcf Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Tue, 10 Dec 2024 15:39:15 +0200 Subject: [PATCH] Add option to skip live videos --- get_youtube_videos/get_youtube_videos.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/get_youtube_videos/get_youtube_videos.py b/get_youtube_videos/get_youtube_videos.py index cfcbe07..9b3ad5b 100644 --- a/get_youtube_videos/get_youtube_videos.py +++ b/get_youtube_videos/get_youtube_videos.py @@ -101,7 +101,7 @@ class GetYoutubeVideos: ) with open(info_filename, 'w', encoding='utf-8') as info_file: json.dump(video_info, info_file, indent=2) - if video_info['live_status'] == 'is_live': + if self.config['skip_live_videos'] and video_info['live_status'] == 'is_live': self._log.debug( "Skipping video '%s' as it's a live video", video_info.get('title', '?') @@ -344,6 +344,12 @@ class GetYoutubeVideos: default=False, help='Create folders per channel and save videos inside their channel folder' ) +@click.option( + '--skip-live-videos', '-S', + is_flag=True, + default=False, + help='Skip live videos' +) @click_config_file.configuration_option() def __main__(**kwargs): return GetYoutubeVideos(**kwargs)