diff --git a/archivebox/index.py b/archivebox/index.py index 74e7dd42..eab2197b 100644 --- a/archivebox/index.py +++ b/archivebox/index.py @@ -120,12 +120,18 @@ def write_json_links_index(out_dir: str, links: List[Link]) -> None: def parse_json_links_index(out_dir: str=OUTPUT_DIR) -> Iterator[Link]: """parse a archive index json file and return the list of links""" + allowed_fields = {f.name for f in fields(Link)} + index_path = os.path.join(out_dir, 'index.json') if os.path.exists(index_path): with open(index_path, 'r', encoding='utf-8') as f: links = json.load(f)['links'] - for link in links: - yield Link(**link) + for link_json in links: + yield Link(**{ + key: val + for key, val in link_json.items() + if key in allowed_fields + }) return () diff --git a/archivebox/schema.py b/archivebox/schema.py index 434f9dc5..5aa629d7 100644 --- a/archivebox/schema.py +++ b/archivebox/schema.py @@ -164,7 +164,7 @@ class Link: from util import ts_to_date most_recent = min( - (result.start_ts + (ts_to_date(result.start_ts) for method in self.history.keys() for result in self.history[method]), default=None, @@ -176,7 +176,7 @@ class Link: from util import ts_to_date most_recent = max( - (result.start_ts + (ts_to_date(result.start_ts) for method in self.history.keys() for result in self.history[method]), default=None,