Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Add custom link filter to xenforo crawler (#367)
Jacoba7f1cda65db1
diff --git a/cyberdrop_dl/scraper/crawlers/f95zone_crawler.py b/cyberdrop_dl/scraper/crawlers/f95zone_crawler.pyindex 532eca5e3..a0d8b6053 100644--- a/cyberdrop_dl/scraper/crawlers/f95zone_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/f95zone_crawler.py@@ -41,3 +41,8 @@ class F95ZoneCrawler(XenforoCrawler):if JSON_Resp["status"] == "ok":return URL(JSON_Resp["msg"])return++ async def filter_link(self, link: URL) -> bool:+ if any(part == "thumb" for part in link.parts):+ return URL(str(link).replace("/thumb/", "/"))+ return linkdiff --git a/cyberdrop_dl/scraper/crawlers/xenforo_crawler.py b/cyberdrop_dl/scraper/crawlers/xenforo_crawler.pyindex f596fb789..e55e786f1 100644--- a/cyberdrop_dl/scraper/crawlers/xenforo_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/xenforo_crawler.py@@ -243,6 +243,9 @@ class XenforoCrawler(Crawler):embed = re.search(HTTP_URL_PATTERNS[0], data) or re.search(HTTP_URL_PATTERNS[1], data)return embed.group(0).replace("www.", "") if embed else data+ async def filter_link(self, link: URL) -> URL:+ return link+async def process_children(self, scrape_item: ScrapeItem, links: list[Tag], selector: str) -> None:for link_obj in links:link: Tag = link_obj.get(selector) or link_obj.get("href")@@ -259,6 +262,9 @@ class XenforoCrawler(Crawler):if str(link).startswith("data:image/svg"):continuelink = await self.get_absolute_link(link)+ link = await self.filter_link(link)+ if not link:+ continueawait self.handle_link(scrape_item, link)scrape_item.add_children()