Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Fix GoFile website token refresh (#802)
mullertremoloddc8b4fd033f
diff --git a/cyberdrop_dl/managers/client_manager.py b/cyberdrop_dl/managers/client_manager.pyindex 12b4f7d3e..72088d865 100644--- a/cyberdrop_dl/managers/client_manager.py+++ b/cyberdrop_dl/managers/client_manager.py@@ -4,6 +4,7 @@ import asyncioimport sslfrom http import HTTPStatusfrom typing import TYPE_CHECKING+import osimport aiohttpimport certifi@@ -14,7 +15,7 @@ from yarl import URLfrom cyberdrop_dl.clients.download_client import DownloadClientfrom cyberdrop_dl.clients.errors import DownloadFailurefrom cyberdrop_dl.clients.scraper_client import ScraperClient-from cyberdrop_dl.utils.utilities import CustomHTTPStatus+from cyberdrop_dl.utils.utilities import CustomHTTPStatus, logif TYPE_CHECKING:from cyberdrop_dl.managers.manager import Manager@@ -77,6 +78,10 @@ class ClientManager:headers = response.headersresponse_url = response.url+ if os.getenv("CYDL_ENABLE_SENSITIVE_HTTP_LOGS") == "2":+ # Log all responses+ await log(f"Response: {response}\nRequest: {response.request_info}", 10)+if not headers.get('Content-Type'):raise DownloadFailure(status=CustomHTTPStatus.IM_A_TEAPOT, message="No content-type in response header")@@ -89,6 +94,10 @@ class ClientManager:if HTTPStatus.OK <= status < HTTPStatus.BAD_REQUEST:return+ if os.getenv("CYDL_ENABLE_SENSITIVE_HTTP_LOGS") == "1":+ # Only log responses to unsuccessful requests+ await log(f"Response: {response}\nRequest: {response.request_info}", 10)+try:phrase = HTTPStatus(status).phraseexcept ValueError:diff --git a/cyberdrop_dl/scraper/crawlers/gofile_crawler.py b/cyberdrop_dl/scraper/crawlers/gofile_crawler.pyindex 2d52071d4..a93dc1030 100644--- a/cyberdrop_dl/scraper/crawlers/gofile_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/gofile_crawler.py@@ -9,7 +9,7 @@ import aiohttp.client_exceptionsfrom aiolimiter import AsyncLimiterfrom yarl import URL-from cyberdrop_dl.clients.errors import ScrapeFailure+from cyberdrop_dl.clients.errors import ScrapeFailure, DownloadFailurefrom cyberdrop_dl.scraper.crawler import Crawlerfrom cyberdrop_dl.utils.dataclasses.url_objects import ScrapeItemfrom cyberdrop_dl.utils.utilities import get_filename_and_ext, error_handling_wrapper@@ -53,7 +53,7 @@ class GoFileCrawler(Crawler):try:async with self.request_limiter:JSON_Resp = await self.client.get_json(self.domain, self.api_address / "getContent", params)- except aiohttp.client_exceptions.ClientResponseError as e:+ except DownloadFailure as e:if e.status == http.HTTPStatus.UNAUTHORIZED:self.websiteToken = ""self.manager.cache_manager.remove("gofile_website_token")