Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
implement 'Only_Hosts', bring old_downloaders up to speed with missing portion from main downloaders
Jules-WinnfieldXa8afaeec0e4f
diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.pyindex d5992659c..b5948f313 100644--- a/cyberdrop_dl/__init__.py+++ b/cyberdrop_dl/__init__.py@@ -1 +1 @@-__version__ = "4.0.79"+__version__ = "4.0.81"diff --git a/cyberdrop_dl/base_functions/config_schema.py b/cyberdrop_dl/base_functions/config_schema.pyindex 7b4280387..d455bb294 100644--- a/cyberdrop_dl/base_functions/config_schema.py+++ b/cyberdrop_dl/base_functions/config_schema.py@@ -38,6 +38,7 @@ config_default = ["ignore_cache": False,"ignore_history": False,"skip_hosts": [],+ "only_hosts": []},"Progress_Options": {"hide_new_progress": False,@@ -91,7 +92,7 @@ files_args = ["db_file", "input_file", "log_file", "output_folder", "output_lastforum_args = ["output_last_forum_post", "separate_posts"]ignore_args = ["exclude_videos", "exclude_images", "exclude_audio", "exclude_other", "ignore_cache", "ignore_history",- "skip_hosts"]+ "skip_hosts", "only_hosts"]jdownloader_args = ["apply_jdownloader", "jdownloader_username", "jdownloader_password", "jdownloader_device"]diff --git a/cyberdrop_dl/downloader/old_downloaders.py b/cyberdrop_dl/downloader/old_downloaders.pyindex 0978770bb..ac93bdf58 100644--- a/cyberdrop_dl/downloader/old_downloaders.py+++ b/cyberdrop_dl/downloader/old_downloaders.py@@ -243,6 +243,18 @@ class Old_Downloader:self.current_attempt.pop(url_path)await self.output_failed(media, e)return+ if e.code == HTTPStatus.SERVICE_UNAVAILABLE or e.code == 521:+ if hasattr(e, "message"):+ if not e.message:+ e.message = "Web server is down"+ logging.debug(f"\n{media.url} ({e.message})")+ await log(f"Failed Download: {media.filename}", quiet=True)+ self.files.failed_files += 1+ self.progress.update(1)+ if url_path in self.current_attempt.keys():+ self.current_attempt.pop(url_path)+ await self.output_failed(media, e)+ returnlogger.debug("Error status code: " + str(e.code))new_error.code = e.codediff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.pyindex 03184334d..3ce691ccc 100644--- a/cyberdrop_dl/main.py+++ b/cyberdrop_dl/main.py@@ -44,6 +44,7 @@ def parse_args() -> argparse.Namespace:parser.add_argument("--ignore-cache", help="ignores previous runs cached scrape history", action="store_true")parser.add_argument("--ignore-history", help="ignores previous download history", action="store_true")parser.add_argument("--skip-hosts", choices=SkipData.supported_hosts, help="removes host links from downloads", action="append", default=[])+ parser.add_argument("--only-hosts", choices=SkipData.supported_hosts, help="only allows downloads from these hosts", action="append", default=[])# Runtime argumentsparser.add_argument("--allow-insecure-connections", help="allows insecure connections from content hosts", action="store_true")diff --git a/cyberdrop_dl/scraper/Scraper.py b/cyberdrop_dl/scraper/Scraper.pyindex 4e78675b0..7e70d6736 100644--- a/cyberdrop_dl/scraper/Scraper.py+++ b/cyberdrop_dl/scraper/Scraper.py@@ -42,6 +42,7 @@ class ScrapeMapper:self.Cascade = CascadeItem({})self.Forums = ForumItem({})self.skip_data = SkipData(args['Ignore']['skip_hosts'])+ self.only_data = SkipData(args['Ignore']['only_hosts'])self.unsupported_file = args["Files"]["unsupported_urls_file"]self.unsupported_output = args['Runtime']['output_unsupported_urls']@@ -342,7 +343,12 @@ class ScrapeMapper:returnfor key, value in self.mapping.items():if key in url_to_map.host:- if any(site in key for site in self.skip_data.sites):+ if self.only_data.sites:+ if any(site in key for site in self.only_data.sites):+ await value(url=url_to_map, title=title)+ else:+ await log(f"[yellow]Skipping: {str(url_to_map)}[/yellow]", quiet=self.quiet)+ elif any(site in key for site in self.skip_data.sites):await log(f"[yellow]Skipping: {str(url_to_map)}[/yellow]", quiet=self.quiet)else:await value(url=url_to_map, title=title)