From d5cabe05afd4d1b59eb5dd1702753a58b9e08eee Mon Sep 17 00:00:00 2001 From: Cristian Date: Mon, 11 Jan 2021 08:28:41 -0500 Subject: [PATCH] fix: Invalid file path being generated on `add` --- archivebox/core/models.py | 1 - archivebox/main.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/archivebox/core/models.py b/archivebox/core/models.py index 655a01c5..bdffddc5 100644 --- a/archivebox/core/models.py +++ b/archivebox/core/models.py @@ -213,7 +213,6 @@ class Snapshot(models.Model): return self.history['title'][-1].output.strip() return None - @cached_property def domain(self) -> str: from ..util import domain diff --git a/archivebox/main.py b/archivebox/main.py index f1032181..f2ac951c 100644 --- a/archivebox/main.py +++ b/archivebox/main.py @@ -576,7 +576,7 @@ def add(urls: Union[str, List[str]], log_crawl_started(new_snapshots) for new_snapshot in new_snapshots: # TODO: Check if we need to add domain to the Snapshot model - downloaded_file = save_file_as_source(new_snapshot.url, filename=f'{new_snapshot.timestamp}-crawl-{new_snapshot.url}.txt', out_dir=out_dir) + downloaded_file = save_file_as_source(new_snapshot.url, filename=f'{new_snapshot.timestamp}-crawl-{new_snapshot.domain}.txt', out_dir=out_dir) new_snapshots_depth += parse_snapshots_from_source(downloaded_file, root_url=new_snapshot.url) imported_snapshots = [Snapshot(url=snapshot.url) for snapshot in new_snapshots + new_snapshots_depth]