Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Finish Fapello, reduced throttle default time from 0.25 to 0.1s
Jules-WinnfieldX659b1ce33dda
diff --git a/cyberdrop_dl/client/client.py b/cyberdrop_dl/client/client.pyindex 9765f3f72..07d9c465e 100644--- a/cyberdrop_dl/client/client.py+++ b/cyberdrop_dl/client/client.py@@ -44,8 +44,7 @@ class ScrapeSession:async def get_BS4(self, url: URL):async with self.client.simultaneous_session_limit:async with self.rate_limiter:- async with self.client_session.get(url, ssl=self.client.ssl_context,- verify_ssl=self.client.verify_ssl) as response:+ async with self.client_session.get(url, ssl=self.client.ssl_context) as response:text = await response.text()soup = BeautifulSoup(text, 'html.parser')return soup@@ -53,8 +52,7 @@ class ScrapeSession:async def get_BS4_and_url(self, url: URL):async with self.client.simultaneous_session_limit:async with self.rate_limiter:- async with self.client_session.get(url, ssl=self.client.ssl_context,- verify_ssl=self.client.verify_ssl) as response:+ async with self.client_session.get(url, ssl=self.client.ssl_context) as response:text = await response.text()soup = BeautifulSoup(text, 'html.parser')return soup, URL(response.url)@@ -62,39 +60,34 @@ class ScrapeSession:async def get_json(self, url: URL):async with self.client.simultaneous_session_limit:async with self.rate_limiter:- async with self.client_session.get(url, ssl=self.client.ssl_context,- verify_ssl=self.client.verify_ssl) as response:+ async with self.client_session.get(url, ssl=self.client.ssl_context) as response:content = json.loads(await response.content.read())return contentasync def get_text(self, url: URL):async with self.client.simultaneous_session_limit:async with self.rate_limiter:- async with self.client_session.get(url, ssl=self.client.ssl_context,- verify_ssl=self.client.verify_ssl) as response:+ async with self.client_session.get(url, ssl=self.client.ssl_context) as response:text = await response.text()return textasync def post(self, url: URL, data: dict):async with self.client.simultaneous_session_limit:async with self.rate_limiter:- async with self.client_session.post(url, data=data, headers=self.headers, ssl=self.client.ssl_context,- verify_ssl=self.client.verify_ssl) as response:+ async with self.client_session.post(url, data=data, headers=self.headers, ssl=self.client.ssl_context) as response:content = json.loads(await response.content.read())return contentasync def get_no_resp(self, url: URL, headers: dict):async with self.client.simultaneous_session_limit:async with self.rate_limiter:- async with self.client_session.get(url, headers=headers, ssl=self.client.ssl_context,- verify_ssl=self.client.verify_ssl) as response:+ async with self.client_session.get(url, headers=headers, ssl=self.client.ssl_context) as response:passasync def post_data_no_resp(self, url: URL, data: dict):async with self.client.simultaneous_session_limit:async with self.rate_limiter:- async with self.client_session.post(url, data=data, headers=self.headers, ssl=self.client.ssl_context,- verify_ssl=self.client.verify_ssl) as response:+ async with self.client_session.post(url, data=data, headers=self.headers, ssl=self.client.ssl_context) as response:passasync def exit_handler(self):@@ -120,8 +113,7 @@ class DownloadSession:headers['user-agent'] = self.client.user_agentawait throttle(self, current_throttle, media.url.host)async with self.client_session.get(media.url, headers=headers, ssl=self.client.ssl_context,- raise_for_status=True, proxy=proxy,- verify_ssl=self.client.verify_ssl) as resp:+ raise_for_status=True, proxy=proxy) as resp:content_type = resp.headers.get('Content-Type')if 'text' in content_type.lower() or 'html' in content_type.lower():logger.debug("Server for %s is experiencing issues, you are being ratelimited, or cookies have expired", str(media.url))diff --git a/cyberdrop_dl/client/rate_limiting.py b/cyberdrop_dl/client/rate_limiting.pyindex 99cb16886..acdc5a90d 100644--- a/cyberdrop_dl/client/rate_limiting.py+++ b/cyberdrop_dl/client/rate_limiting.py@@ -81,5 +81,5 @@ async def throttle(self, delay: int, host: str) -> None:self.throttle_times[key] = nowreturn- remaining = delay - elapsed + 0.25+ remaining = delay - elapsed + 0.1await asyncio.sleep(remaining)diff --git a/cyberdrop_dl/crawlers/Fapello_Spider.py b/cyberdrop_dl/crawlers/Fapello_Spider.pyindex 9bb062e5f..08558e49e 100644--- a/cyberdrop_dl/crawlers/Fapello_Spider.py+++ b/cyberdrop_dl/crawlers/Fapello_Spider.py@@ -59,7 +59,6 @@ class FapelloCrawler:async def parse_post(self, session: ScrapeSession, url: URL):try:- await log("Scraping post: " + str(url), quiet=self.quiet)soup = await session.get_BS4(url)results = []diff --git a/cyberdrop_dl/scraper/Scraper.py b/cyberdrop_dl/scraper/Scraper.pyindex 382133cf4..fa1187b58 100644--- a/cyberdrop_dl/scraper/Scraper.py+++ b/cyberdrop_dl/scraper/Scraper.py@@ -60,7 +60,7 @@ class ScrapeMapper:self.semaphore = asyncio.Semaphore(1)self.mapping = {"anonfiles.com": self.Anonfiles, "bunkr": self.Bunkr, "cyberdrop": self.Cyberdrop,- "cyberfile": self.CyberFile, "erome": self.Erome,+ "cyberfile": self.CyberFile, "erome": self.Erome, "fapello": self.Fapello,"simpcity": self.Xenforo, "socialmediagirls": self.Xenforo, "xbunker": self.Xenforo}async def handle_additions(self, domain: str, album_obj: Optional[AlbumItem], domain_obj: Optional[DomainItem], title=None):