mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
feat: Fallback to link detail when there is an issue loading a link from main index
This commit is contained in:
parent
0aa3ee06a9
commit
9815241b78
1 changed files with 6 additions and 1 deletions
|
@ -3,6 +3,7 @@ __package__ = 'archivebox.index'
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import json as pyjson
|
import json as pyjson
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List, Optional, Iterator, Any
|
from typing import List, Optional, Iterator, Any
|
||||||
|
@ -49,7 +50,11 @@ def parse_json_main_index(out_dir: str=OUTPUT_DIR) -> Iterator[Link]:
|
||||||
with open(index_path, 'r', encoding='utf-8') as f:
|
with open(index_path, 'r', encoding='utf-8') as f:
|
||||||
links = pyjson.load(f)['links']
|
links = pyjson.load(f)['links']
|
||||||
for link_json in links:
|
for link_json in links:
|
||||||
yield Link.from_json(link_json)
|
try:
|
||||||
|
yield Link.from_json(link_json)
|
||||||
|
except KeyError:
|
||||||
|
detail_index_path = OUTPUT_DIR / Path(f"archive/{link_json['timestamp']}")
|
||||||
|
yield parse_json_link_details(str(detail_index_path))
|
||||||
|
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue