Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: override common medifire errors (#1425)
NTFSvolume7185d3d07547
diff --git a/cyberdrop_dl/crawlers/mediafire.py b/cyberdrop_dl/crawlers/mediafire.pyindex 5b1a9b3bf..4f4240802 100644--- a/cyberdrop_dl/crawlers/mediafire.py+++ b/cyberdrop_dl/crawlers/mediafire.py@@ -5,6 +5,7 @@ from __future__ import annotationsimport base64import dataclassesimport itertools+from http import HTTPStatusfrom typing import TYPE_CHECKING, Any, ClassVar, Literalfrom cyberdrop_dl.crawlers.crawler import Crawler, SupportedPaths, auto_task_id@@ -43,6 +44,11 @@ class File:_PRIMARY_URL = AbsoluteHttpURL("https://www.mediafire.com/")_API_URL = _PRIMARY_URL / "api/1.4"+_API_ERRORS_OVERRIDES: dict[int, int] = {+ 110: HTTPStatus.GONE,+ 105: HTTPStatus.GONE,+ 293: HTTPStatus.UNAVAILABLE_FOR_LEGAL_REASONS,+}class MediaFireCrawler(Crawler):@@ -67,6 +73,9 @@ class MediaFireCrawler(Crawler):resp: dict[str, Any] = json_resp["response"]if resp["result"] != "Success":code: int = resp["error"]+ if http_code := _API_ERRORS_OVERRIDES.get(code):+ raise ScrapeError(http_code)+ui_failure = f"MediaFire Error ({code})"raise ScrapeError(ui_failure, resp["message"])