Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: apply change to parse_url to handle relative urls (#501)

datawhores3a304ceeb15a
diff --git a/cyberdrop_dl/scraper/crawler.py b/cyberdrop_dl/scraper/crawler.py
index 6c1623a56..a15c524e1 100644
--- a/cyberdrop_dl/scraper/crawler.py
+++ b/cyberdrop_dl/scraper/crawler.py
@@ -324,15 +324,12 @@ class Crawler(ABC):
assert isinstance(link_str, str)
encoded = "%" in link_str
base = relative_to or self.primary_base_domain
- if link_str.startswith("?"):
- link = base.with_query(link_str[1:])
- elif link_str.startswith("//"):
- link = URL("https:" + link_str, encoded=encoded)
- elif link_str.startswith("/"):
- link = base.joinpath(link_str[1:], encoded=encoded)
- else:
- link = URL(link_str, encoded=encoded)
- return link
+ new_url = URL(link_str, encoded=encoded)
+ if not new_url.absolute:
+ new_url = base.join(new_url)
+ if not new_url.scheme:
+ new_url = new_url.with_scheme(base.scheme or "https")
+ return new_url
def create_task_id(func: Callable) -> Callable: