From 7cbb02f8ff03108d39783d9cee58f8feede15275 Mon Sep 17 00:00:00 2001 From: Dan Niles <56271899+dan-niles@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:52:10 +0530 Subject: [PATCH] Raise exception if there are no videos in the playlists --- CHANGELOG.md | 4 ++++ scraper/src/youtube2zim/scraper.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eef70923..3ed95834 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Raise exception if there are no videos in the playlists (#347) + ## [3.2.0] - 2024-10-11 ### Deprecated diff --git a/scraper/src/youtube2zim/scraper.py b/scraper/src/youtube2zim/scraper.py index d0a29b63..0c76e4f9 100644 --- a/scraper/src/youtube2zim/scraper.py +++ b/scraper/src/youtube2zim/scraper.py @@ -618,6 +618,10 @@ def extract_videos_list(self): for playlist in empty_playlists: self.playlists.remove(playlist) + + # Raise exception if no videos found in playlists + if not self.playlists: + raise Exception("No videos found in playlists") self.videos_ids = [*all_videos.keys()] # unpacking so it's subscriptable def download_video_files(self, max_concurrency):