Skip to content

Bulk asynchronous downloader for multiple file hosts

Make uniform - In parts instead of path starts with.

Jules-WinnfieldXc311c297291f
diff --git a/cyberdrop_dl/scraper/crawlers/bunkr_crawler.py b/cyberdrop_dl/scraper/crawlers/bunkr_crawler.py
index 30f13e332..be5328e87 100644
--- a/cyberdrop_dl/scraper/crawlers/bunkr_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/bunkr_crawler.py
@@ -70,9 +70,9 @@ class BunkrCrawler:
task_id = await self.scraping_progress.add_task(scrape_item.url)
scrape_item.url = await self.get_stream_link(scrape_item.url)
- if scrape_item.url.path.startswith("/a/"):
+ if "a" in scrape_item.url.parts:
await self.album(scrape_item)
- elif scrape_item.url.path.startswith("/v/"):
+ elif "v" in scrape_item.url.parts:
await self.video(scrape_item)
else:
await self.other(scrape_item)
diff --git a/cyberdrop_dl/scraper/crawlers/ehentai_crawler.py b/cyberdrop_dl/scraper/crawlers/ehentai_crawler.py
index 431c60e71..652168dd5 100644
--- a/cyberdrop_dl/scraper/crawlers/ehentai_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/ehentai_crawler.py
@@ -58,13 +58,15 @@ class EHentaiCrawler:
await log(f"Scrape Finished: {item.url}")
await self.finish_task()
+ """~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"""
+
async def fetch(self, scrape_item: ScrapeItem) -> None:
"""Determines where to send the scrape item based on the url"""
task_id = await self.scraping_progress.add_task(scrape_item.url)
- if scrape_item.url.path.startswith("/g/"):
+ if "g" in scrape_item.url.parts:
await self.album(scrape_item)
- elif scrape_item.url.path.startswith("/s/"):
+ elif "s" in scrape_item.url.parts:
await self.image(scrape_item)
else:
await log(f"Scrape Error: Unknown URL Path for {scrape_item.url}")
@@ -72,8 +74,6 @@ class EHentaiCrawler:
await self.scraping_progress.remove_task(task_id)
- """~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"""
-
@error_handling_wrapper
async def album(self, scrape_item: ScrapeItem) -> None:
"""Scrapes an album"""
diff --git a/cyberdrop_dl/scraper/crawlers/erome_crawler.py b/cyberdrop_dl/scraper/crawlers/erome_crawler.py
index aa590fa6e..0dbae2d95 100644
--- a/cyberdrop_dl/scraper/crawlers/erome_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/erome_crawler.py
@@ -64,7 +64,7 @@ class EromeCrawler:
"""Determines where to send the scrape item based on the url"""
task_id = await self.scraping_progress.add_task(scrape_item.url)
- if scrape_item.url.path.startswith("/a/"):
+ if "a" in scrape_item.url.parts:
await self.album(scrape_item)
else:
await self.profile(scrape_item)