Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
fix: parsing of filenames from unsupported forums (#708)
NTFSvolume54e5c14cf2af
diff --git a/cyberdrop_dl/utils/constants.py b/cyberdrop_dl/utils/constants.pyindex 958adcfad..982da2ec3 100644--- a/cyberdrop_dl/utils/constants.py+++ b/cyberdrop_dl/utils/constants.py@@ -140,3 +140,6 @@ FILE_FORMATS = {".zip",},}+++MEDIA_EXTENSIONS = FILE_FORMATS["Audio"] | FILE_FORMATS["Videos"] | FILE_FORMATS["Images"]diff --git a/cyberdrop_dl/utils/utilities.py b/cyberdrop_dl/utils/utilities.pyindex 22a1fd04d..093584731 100644--- a/cyberdrop_dl/utils/utilities.py+++ b/cyberdrop_dl/utils/utilities.py@@ -123,9 +123,12 @@ def get_filename_and_ext(filename: str, forum: bool = False) -> tuple[str, str]:if not filename_as_path.suffix:raise NoExtensionErrorext_no_dot = filename_as_path.suffix.split(".")[1]- if ext_no_dot.isdigit() and forum:+ if ext_no_dot.isdigit() and forum and "-" in filename:name, ext = filename_as_path.name.rsplit("-", 1)ext = ext.rsplit(".")[0]+ ext_w_dot = f".{ext}".lower()+ if ext_w_dot not in constants.MEDIA_EXTENSIONS:+ raise InvalidExtensionErrorfilename_as_path = Path(f"{name}.{ext}")if len(filename_as_path.suffix) > 5:raise InvalidExtensionError