Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: content links parsing (kemono)

NTFSvolume202ca2b36da9
diff --git a/cyberdrop_dl/scraper/crawlers/kemono_crawler.py b/cyberdrop_dl/scraper/crawlers/kemono_crawler.py
index a46118fa8..4e68bff50 100644
--- a/cyberdrop_dl/scraper/crawlers/kemono_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/kemono_crawler.py
@@ -136,11 +136,16 @@ class KemonoCrawler(Crawler):
await scrape_item.add_to_parent_title(post_title)
await scrape_item.add_to_parent_title("Loose Files")
- yarl_links = []
+ yarl_links: list[URL] = []
all_links = [x.group().replace(".md.", ".") for x in
- re.finditer(r"(?:http.*?)(?=($|\n|\r\n|\r|\s|\"|\[/URL]|']\[|]\[|\[/img]|</a>|</p>))", content)]
+ re.finditer(r"(?:http(?!.*\.\.)[^ ]*?)(?=($|\n|\r\n|\r|\s|\"|\[/URL]|']\[|]\[|\[/img]|</|'))", content)]
+
for link in all_links:
- yarl_links.append(URL(link))
+ try:
+ url = URL(link)
+ yarl_links.append(url)
+ except ValueError:
+ pass
for link in yarl_links:
if "kemono" in link.host: