Skip to content

Bulk asynchronous downloader for multiple file hosts

Proper handling for errors with direct link checks

Jules-WinnfieldX1bf9d6582232
diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py
index 348714e52..a732b6a05 100644
--- a/cyberdrop_dl/__init__.py
+++ b/cyberdrop_dl/__init__.py
@@ -1 +1 @@
-__version__ = "4.2.111"
+__version__ = "4.2.112"
diff --git a/cyberdrop_dl/crawlers/Xenforo_Spider.py b/cyberdrop_dl/crawlers/Xenforo_Spider.py
index ba6331ee7..579a11376 100644
--- a/cyberdrop_dl/crawlers/Xenforo_Spider.py
+++ b/cyberdrop_dl/crawlers/Xenforo_Spider.py
@@ -331,12 +331,18 @@ class XenforoCrawler:
break
# Handle links
- def is_direct_link(host: str) -> bool:
- assert url.host is not None
- host_su = host.replace(".st", ".su")
- return host_su in url.host or url.host in host_su or "smgmedia" in host
-
- direct_links = [x for x in content_links if is_direct_link(x[0].host)]
+ async def is_direct_link(url_to_check: URL) -> bool:
+ host = url_to_check.host
+ try:
+ assert url.host is not None
+ host_su = host.replace(".st", ".su")
+ return host_su in url.host or url.host in host_su or "smgmedia" in host
+ except AttributeError as e:
+ logger.debug("Error encountered while handling %s", url_to_check, exc_info=True)
+ await self.error_writer.write_errored_scrape(url_to_check, e, self.quiet)
+ return False
+
+ direct_links = [x for x in content_links if await is_direct_link(x[0])]
external_links = [x for x in content_links if x not in direct_links]
await self.handle_direct_links(cascade, direct_links, url, spec.domain)
await self.handle_external_links(external_links, url)