diff --git a/src/ytdl_sub/downloaders/url/downloader.py b/src/ytdl_sub/downloaders/url/downloader.py index dfebcf7c..1f9aeef3 100644 --- a/src/ytdl_sub/downloaders/url/downloader.py +++ b/src/ytdl_sub/downloaders/url/downloader.py @@ -443,14 +443,10 @@ class BaseUrlDownloader(BaseDownloader[BaseDownloaderOptionsT], ABC): ): yield entry_child - def _download_url_metadata( - self, collection_url: UrlValidator - ) -> Tuple[List[EntryParent], List[Entry]]: + def _download_url_metadata(self, url: str) -> Tuple[List[EntryParent], List[Entry]]: """ Downloads only info.json files and forms EntryParent trees """ - url = self.overrides.apply_formatter(collection_url.url) - with self._separate_download_archives(): entry_dicts = YTDLP.extract_info_via_info_json( working_directory=self.working_directory, @@ -494,7 +490,11 @@ class BaseUrlDownloader(BaseDownloader[BaseDownloaderOptionsT], ABC): """The function to perform the download of all media entries""" # download the bottom-most urls first since they are top-priority for collection_url in reversed(self.collection.urls.list): - parents, orphan_entries = self._download_url_metadata(collection_url=collection_url) + # URLs can be empty. If they are, then skip + if not (url := self.overrides.apply_formatter(collection_url.url)): + continue + + parents, orphan_entries = self._download_url_metadata(url=url) # TODO: Encapsulate this logic into its own class self._url_state = URLDownloadState( diff --git a/tests/unit/prebuilt_presets/test_prebuilt_presets.py b/tests/unit/prebuilt_presets/test_prebuilt_presets.py index a8a02da7..2cede012 100644 --- a/tests/unit/prebuilt_presets/test_prebuilt_presets.py +++ b/tests/unit/prebuilt_presets/test_prebuilt_presets.py @@ -115,9 +115,7 @@ class TestPrebuiltTVShowPresets: }, } if is_many_urls: - preset_dict = dict( - preset_dict, **{"download": {"urls": [{"url": "https://url.number.2.here"}]}} - ) + preset_dict["overrides"]["url2"] = "https://url.number.2.here" subscription = Subscription.from_dict( config=config,