Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: move filepath utils to root
NTFSvolume97e2b7b9ed5b
diff --git a/cyberdrop_dl/crawlers/crawler.py b/cyberdrop_dl/crawlers/crawler.pyindex eebee56e0..35990a755 100644--- a/cyberdrop_dl/crawlers/crawler.py+++ b/cyberdrop_dl/crawlers/crawler.py@@ -22,6 +22,12 @@ from cyberdrop_dl.constants import CDL_USER_AGENTfrom cyberdrop_dl.crawlers._hls import HLSMixinfrom cyberdrop_dl.downloader.http import Downloaderfrom cyberdrop_dl.exceptions import MaxChildrenError, NoExtensionError, ScrapeError+from cyberdrop_dl.filepath import (+ check_dangerous_filename,+ check_path_traversal,+ compose_filename,+ get_filename_and_ext,+)from cyberdrop_dl.mediaprops import ISO639Subtitle, Resolutionfrom cyberdrop_dl.url_objects import AbsoluteHttpURL, MediaItem, ScrapeItemfrom cyberdrop_dl.utils import (@@ -34,12 +40,6 @@ from cyberdrop_dl.utils import (parse_url,unique,)-from cyberdrop_dl.utils.filepath import (- check_dangerous_filename,- check_path_traversal,- compose_filename,- get_filename_and_ext,-)from cyberdrop_dl.utils.strings import safe_formatif TYPE_CHECKING:diff --git a/cyberdrop_dl/crawlers/cyberdrop.py b/cyberdrop_dl/crawlers/cyberdrop.pyindex b52e32837..33ce46000 100644--- a/cyberdrop_dl/crawlers/cyberdrop.py+++ b/cyberdrop_dl/crawlers/cyberdrop.py@@ -4,9 +4,9 @@ from typing import TYPE_CHECKING, ClassVarfrom cyberdrop_dl import aiofrom cyberdrop_dl.crawlers.crawler import API, Crawler, RateLimit, SupportedDomains, SupportedPaths+from cyberdrop_dl.filepath import remove_file_idfrom cyberdrop_dl.url_objects import AbsoluteHttpURLfrom cyberdrop_dl.utils import css, error_handling_wrapper-from cyberdrop_dl.utils.filepath import remove_file_idif TYPE_CHECKING:from cyberdrop_dl.url_objects import ScrapeItemdiff --git a/cyberdrop_dl/crawlers/hitomi_la.py b/cyberdrop_dl/crawlers/hitomi_la.pyindex 831ceb252..2eb467ea0 100644--- a/cyberdrop_dl/crawlers/hitomi_la.py+++ b/cyberdrop_dl/crawlers/hitomi_la.py@@ -13,9 +13,9 @@ from typing import TYPE_CHECKING, Any, ClassVarfrom cyberdrop_dl import aiofrom cyberdrop_dl.crawlers.crawler import API, Crawler, SupportedPathsfrom cyberdrop_dl.exceptions import ScrapeError+from cyberdrop_dl.filepath import get_filename_and_extfrom cyberdrop_dl.url_objects import AbsoluteHttpURLfrom cyberdrop_dl.utils import DictDataclass, error_handling_wrapper-from cyberdrop_dl.utils.filepath import get_filename_and_extif TYPE_CHECKING:from collections.abc import AsyncGenerator, Generator, Iterable, Mappingdiff --git a/cyberdrop_dl/crawlers/http_direct.py b/cyberdrop_dl/crawlers/http_direct.pyindex b2190a8f6..51815a3fc 100644--- a/cyberdrop_dl/crawlers/http_direct.py+++ b/cyberdrop_dl/crawlers/http_direct.py@@ -6,7 +6,7 @@ from cyberdrop_dl.constants import FileExtfrom cyberdrop_dl.crawlers.crawler import Crawlerfrom cyberdrop_dl.downloader.http import Downloaderfrom cyberdrop_dl.exceptions import NoExtensionError-from cyberdrop_dl.utils.filepath import get_filename_and_ext+from cyberdrop_dl.filepath import get_filename_and_extif TYPE_CHECKING:from cyberdrop_dl.url_objects import ScrapeItemdiff --git a/cyberdrop_dl/csv_logs.py b/cyberdrop_dl/csv_logs.pyindex efb792a8a..703aefa26 100644--- a/cyberdrop_dl/csv_logs.py+++ b/cyberdrop_dl/csv_logs.py@@ -10,8 +10,8 @@ from typing import TYPE_CHECKING, Any, Selffrom cyberdrop_dl import constantsfrom cyberdrop_dl.exceptions import get_origin+from cyberdrop_dl.filepath import sanitize_filenamefrom cyberdrop_dl.utils import json-from cyberdrop_dl.utils.filepath import sanitize_filenameif TYPE_CHECKING:import datetimediff --git a/cyberdrop_dl/database/transfer.py b/cyberdrop_dl/database/transfer.pyindex 101c0d0b5..5222fca26 100644--- a/cyberdrop_dl/database/transfer.py+++ b/cyberdrop_dl/database/transfer.py@@ -11,9 +11,9 @@ from cyberdrop_dl import databasefrom cyberdrop_dl.database import commonfrom cyberdrop_dl.database.history import apply_fixesfrom cyberdrop_dl.database.schema import CURRENT_VERSION, Version+from cyberdrop_dl.filepath import sanitize_filenamefrom cyberdrop_dl.logs import setup_console_loggingfrom cyberdrop_dl.utils import dates-from cyberdrop_dl.utils.filepath import sanitize_filenamelogger = logging.getLogger(__name__)diff --git a/cyberdrop_dl/utils/filepath.py b/cyberdrop_dl/filepath.pysimilarity index 100%rename from cyberdrop_dl/utils/filepath.pyrename to cyberdrop_dl/filepath.pydiff --git a/cyberdrop_dl/scrape_mapper.py b/cyberdrop_dl/scrape_mapper.pyindex 0d95a92a8..3f845fc39 100644--- a/cyberdrop_dl/scrape_mapper.py+++ b/cyberdrop_dl/scrape_mapper.py@@ -10,7 +10,7 @@ from typing import TYPE_CHECKING, Any, Literal, Selffrom pydantic.types import ByteSize-from cyberdrop_dl import aio, plugins, storage+from cyberdrop_dl import aio, filepath, plugins, storagefrom cyberdrop_dl.clients.jdownloader import JDownloaderfrom cyberdrop_dl.constants import BlockedDomainsfrom cyberdrop_dl.crawlers import create_crawlers@@ -25,7 +25,7 @@ from cyberdrop_dl.exceptions import JDownloaderError, NoExtensionErrorfrom cyberdrop_dl.logs import log_spacerfrom cyberdrop_dl.progress.scraping import ScrapingUIfrom cyberdrop_dl.url_objects import AbsoluteHttpURL, ScrapeItem-from cyberdrop_dl.utils import filepath, remove_trailing_slash+from cyberdrop_dl.utils import remove_trailing_slashif TYPE_CHECKING:from collections.abc import AsyncGenerator, Coroutine, Generator, Iterable, Iterator, Sequencediff --git a/cyberdrop_dl/url_objects.py b/cyberdrop_dl/url_objects.pyindex 42a3fc00a..c1d984547 100644--- a/cyberdrop_dl/url_objects.py+++ b/cyberdrop_dl/url_objects.py@@ -13,7 +13,7 @@ from typing import TYPE_CHECKING, Any, Literal, NamedTuple, Self, final, overloaimport yarlfrom cyberdrop_dl.exceptions import MaxChildrenError-from cyberdrop_dl.utils.filepath import sanitize_folder+from cyberdrop_dl.filepath import sanitize_folderif TYPE_CHECKING:from collections.abc import Generator, Iterable, Sequencediff --git a/tests/test_filename_safeguards.py b/tests/test_filename_safeguards.pyindex ac9f5345f..a5fff78d7 100644--- a/tests/test_filename_safeguards.py+++ b/tests/test_filename_safeguards.py@@ -3,7 +3,7 @@ from pathlib import Pathimport pytestfrom cyberdrop_dl.exceptions import FileNameError, PathTraversalError-from cyberdrop_dl.utils.filepath import check_dangerous_filename, check_path_traversal+from cyberdrop_dl.filepath import check_dangerous_filename, check_path_traversaldef test_path_inside_dl_folder_are_ok(tmp_path: Path) -> None:diff --git a/tests/test_unicode_emoji_sanitization.py b/tests/test_unicode_emoji_sanitization.pyindex f72350ad3..ecdc89e99 100644--- a/tests/test_unicode_emoji_sanitization.py+++ b/tests/test_unicode_emoji_sanitization.py@@ -3,7 +3,7 @@ from pathlib import Pathimport pytest-from cyberdrop_dl.utils.filepath import remove_emojis_and_symbols, sanitize_filename+from cyberdrop_dl.filepath import remove_emojis_and_symbols, sanitize_filenameIS_MACOS = sys.platform == "darwin"diff --git a/tests/test_utils.py b/tests/test_utils.pyindex 5cfa365df..f6cb43f4e 100644--- a/tests/test_utils.py+++ b/tests/test_utils.py@@ -7,7 +7,7 @@ from typing import Anyimport pytestfrom cyberdrop_dl.exceptions import InvalidExtensionError, NoExtensionError-from cyberdrop_dl.utils.filepath import get_filename_and_ext+from cyberdrop_dl.filepath import get_filename_and_extclass TestGetFilenameAndExt: