Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: always send a default HTTP referer

NTFSvolumef5277cfb9187
diff --git a/cyberdrop_dl/crawlers/crawler.py b/cyberdrop_dl/crawlers/crawler.py
index 51f18542d..e246aa38b 100644
--- a/cyberdrop_dl/crawlers/crawler.py
+++ b/cyberdrop_dl/crawlers/crawler.py
@@ -241,7 +241,12 @@ class Crawler(HTTPMixin, HLSMixin, ABC):
_slots=self.__dl_config__.slots,
)
- self.__http_ctx__ = HTTPContext.build(self.DOMAIN, self.__http_config__, self.__throttle)
+ self.__http_ctx__: HTTPContext = HTTPContext.build(self.DOMAIN, self.__http_config__, self.__throttle)
+ try:
+ self.__http_ctx__.headers.setdefault("Referer", str(self.PRIMARY_URL))
+ except AttributeError:
+ pass
+
self._task_mngr: Final = task_mng
self.tui: Final = tui