Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: rewrite URLs (cyberdrop)
NTFSvolume1ba9b34522dd
diff --git a/cyberdrop_dl/crawlers/cyberdrop.py b/cyberdrop_dl/crawlers/cyberdrop.pyindex d0baef9dc..3492b7e9a 100644--- a/cyberdrop_dl/crawlers/cyberdrop.py+++ b/cyberdrop_dl/crawlers/cyberdrop.py@@ -1,6 +1,6 @@from __future__ import annotations-from typing import TYPE_CHECKING, ClassVar+from typing import TYPE_CHECKING, ClassVar, overridefrom cyberdrop_dl import aiofrom cyberdrop_dl.clients.http import HTTPConfig@@ -43,16 +43,24 @@ class CyberdropCrawler(Crawler):async def fetch(self, scrape_item: ScrapeItem) -> None:match scrape_item.url.parts[1:]:case ["a", album_id, *_]:- return await self.album(scrape_item, album_id)- case ["api", "file" | "proxy", "d" | "auth" | "thumb", file_id, *_]:- return await self.file(scrape_item, file_id)- case ["f" | "e", file_id]:- return await self.file(scrape_item, file_id)+ await self.album(scrape_item, album_id)+ case ["f", file_id]:+ await self.file(scrape_item, file_id)case [_]:- return await self.follow_redirect(scrape_item)+ await self.follow_redirect(scrape_item)case _:raise ValueError+ @classmethod+ @override+ def transform_url(cls, url: AbsoluteHttpURL) -> AbsoluteHttpURL:+ url = super().transform_url(url)+ match url.parts[1:]:+ case ["e", file_id] | ["api", "file" | "proxy", "d" | "auth" | "thumb", file_id, *_]:+ return url.origin() / "f" / file_id+ case _:+ return url+@error_handling_wrapperasync def album(self, scrape_item: ScrapeItem, album_id: str) -> None:scrape_item.url = scrape_item.url.with_query("nojs")