diff --git a/scrapy_webarchive/extensions.py b/scrapy_webarchive/extensions.py index 4587cb0..60ded25 100644 --- a/scrapy_webarchive/extensions.py +++ b/scrapy_webarchive/extensions.py @@ -63,7 +63,7 @@ def __init__(self, settings: Settings, crawler: Crawler) -> None: # Initialize store and writer self.store: FilesStoreProtocol = self._get_store(store_uri) - self.writer = WarcFileWriter(collection_name=crawler.spider.name) + self.writer = WarcFileWriter(collection_name=crawler.spidercls.name) def _check_configuration_prerequisites(self) -> None: """raises NotConfigured if essential settings or middleware configurations are incorrect.""" @@ -82,7 +82,7 @@ def _retrieve_store_uri_and_wacz_fname(self) -> Tuple[str, Union[str, None]]: """Sets up the export URI based on configuration and spider context.""" export_uri = self.settings["SW_EXPORT_URI"].format( - spider=self.crawler.spider.name, + spider=self.crawler.spidercls.name, **get_archive_uri_template_dt_variables(), )