Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
create command line args to match config
Jules-WinnfieldX97932664ed89
diff --git a/cyberdrop_dl/base_functions/config_schema.py b/cyberdrop_dl/base_functions/config_schema.pyindex 6c85c4af7..184e88105 100644--- a/cyberdrop_dl/base_functions/config_schema.py+++ b/cyberdrop_dl/base_functions/config_schema.py@@ -45,18 +45,18 @@ config_default = ["throttle": 0.5,},"Runtime": {- "simultaneous_downloads": 0,"allow_insecure_connections": False,"attempts": 10,- "required_free_space": 5,+ "block_sub_folders": True,"disable_attempt_limit": False,"include_id": False,"mark_downloaded": False,- "allow_sub_folders": True,- "remove_bunkr_identifier": True,"output_errored_urls": False,"output_unsupported_urls": False,"proxy": "",+ "remove_bunkr_identifier": False,+ "required_free_space": 5,+ "simultaneous_downloads": 0,},"Sorting": {"sort_downloads": False,diff --git a/cyberdrop_dl/downloader/downloaders.py b/cyberdrop_dl/downloader/downloaders.pyindex 85a285adf..ea0d5db22 100644--- a/cyberdrop_dl/downloader/downloaders.py+++ b/cyberdrop_dl/downloader/downloaders.py@@ -93,7 +93,7 @@ class Downloader:self.exclude_videos = args["Ignore"]["exclude_videos"]self.exclude_other = args["Ignore"]["exclude_other"]- self.allow_sub_folders = args['Runtime']['allow_sub_folders']+ self.block_sub_folders = args['Runtime']['block_sub_folders']self.allowed_attempts = args["Runtime"]["attempts"]self.allow_insecure_connections = args["Runtime"]["allow_insecure_connections"]self.disable_attempt_limit = args["Runtime"]["disable_attempt_limit"]@@ -209,7 +209,7 @@ class Downloader:url_path = await get_db_path(URL(media.url), self.domain)- if not self.allow_sub_folders:+ if self.block_sub_folders:album = album.split('/')[0]try:@@ -281,7 +281,7 @@ class Downloader:album_progress.advance(album_task, 1)file_progress.update(file_task, visible=False)- await log(f"Completed Download: {media.filename}", quiet=True)+ await log(f"Completed Download: {media.filename} from {media.referer}", quiet=True)await self.File_Lock.remove_lock(original_filename)returndiff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.pyindex c737c3fd3..cbb72780f 100644--- a/cyberdrop_dl/main.py+++ b/cyberdrop_dl/main.py@@ -28,9 +28,10 @@ def parse_args() -> argparse.Namespace:parser.add_argument("--config-file", type=Path, help="config file to read arguments from", default="config.yaml")parser.add_argument("--db-file", type=Path, help="history database file to write to", default="download_history.sqlite")- parser.add_argument("--output-last-forum-file", type=Path, help="the text file to output last scraped post from a forum thread for re-feeding into CDL", default="URLs_Last_Post.txt")- parser.add_argument("--unsupported-urls-file", type=Path, help="the csv file to output unsupported links into", default="Unsupported_URLs.csv")+ parser.add_argument("--errored-urls-file", type=Path, help="csv file to write failed download information to", default="Errored_URLs.csv")parser.add_argument("--log-file", type=Path, help="log file to write to", default="downloader.log")+ parser.add_argument("--output-last-forum-post-file", type=Path, help="the text file to output last scraped post from a forum thread for re-feeding into CDL", default="URLs_Last_Post.txt")+ parser.add_argument("--unsupported-urls-file", type=Path, help="the csv file to output unsupported links into", default="Unsupported_URLs.csv")# Ignoreparser.add_argument("--exclude-audio", help="skip downloading of audio files", action="store_true")@@ -44,13 +45,25 @@ def parse_args() -> argparse.Namespace:# Runtime argumentsparser.add_argument("--allow-insecure-connections", help="Allows insecure connections from content hosts", action="store_true")parser.add_argument("--attempts", type=int, help="number of attempts to download each file", default=10)+ parser.add_argument("--block-sub-folders", help="Block sub folders from being created", action="store_true")parser.add_argument("--disable-attempt-limit", help="disables the attempt limitation", action="store_true")parser.add_argument("--include-id", help="include the ID in the download folder name", action="store_true")parser.add_argument("--mark-downloaded", help="sets the scraped files as downloaded without downloading", action="store_true")+ parser.add_argument("--output-errored-urls", help="sets the failed urls to be output to the errored urls file", action="store_true")+ parser.add_argument("--output-unsupported-urls", help="sets the unsupported urls to be output to the unsupported urls file", action="store_true")parser.add_argument("--proxy", help="HTTP/HTTPS proxy used for downloading, format [protocal]://[ip]:[port]", default=None)+ parser.add_argument("--remove-bunker-identifier", help="Removes the bunkr added identifier from output filenames", action="store_true")parser.add_argument("--required-free-space", type=int, help="required free space (in gigabytes) for the program to run", default=5)parser.add_argument("--simultaneous-downloads", type=int, help="number of threads to use (0 = max)", default=0)+ # Sorting+ parser.add_argument("--sort-downloads", help="sorts downloaded files after downloads have finished", action="store_true")+ parser.add_argument("--sort-directory", type=Path, help="folder to download files to", default="Sorted Downloads")+ parser.add_argument("--sorted-audio", type=str, help="schema to sort audio", default="{sort_dir}/{base_dir}/Audio")+ parser.add_argument("--sorted-images", type=str, help="schema to sort images", default="{sort_dir}/{base_dir}/Images")+ parser.add_argument("--sorted-others", type=str, help="schema to sort other", default="{sort_dir}/{base_dir}/Other")+ parser.add_argument("--sorted-videos", type=str, help="schema to sort videos", default="{sort_dir}/{base_dir}/Videos")+# Ratelimitingparser.add_argument("--connection-timeout", type=int, help="number of seconds to wait attempting to connect to a URL during the downloading phase", default=15)parser.add_argument("--ratelimit", type=int, help="this will add a ratelimiter to requests made in the program during scraping, the number you provide is in requests/seconds", default=50)@@ -70,7 +83,7 @@ def parse_args() -> argparse.Namespace:parser.add_argument("--xbunker-username", type=str, help="username to login to xbunker", default=None)# JDownloader details- parser.add_argument("--apply_jdownloader", help="enables sending unsupported URLs to a running jdownloader2 instance to download", action="store_true")+ parser.add_argument("--apply-jdownloader", help="enables sending unsupported URLs to a running jdownloader2 instance to download", action="store_true")parser.add_argument("--jdownloader-username", type=str, help="username to login to jdownloader", default=None)parser.add_argument("--jdownloader-password", type=str, help="password to login to jdownloader", default=None)parser.add_argument("--jdownloader-device", type=str, help="device name to login to for jdownloader", default=None)