mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-11 07:04:14 +00:00
Merge pull request #446 from cdvv7788/hotfix/#445
This commit is contained in:
commit
7c16944a44
1 changed files with 10 additions and 8 deletions
|
@ -62,19 +62,21 @@ def save_readability(link: Link, out_dir: Optional[str]=None, timeout: int=TIMEO
|
||||||
output_folder = out_dir.absolute() / "readability"
|
output_folder = out_dir.absolute() / "readability"
|
||||||
output = str(output_folder)
|
output = str(output_folder)
|
||||||
|
|
||||||
document = get_html(link, out_dir)
|
|
||||||
temp_doc = NamedTemporaryFile(delete=False)
|
|
||||||
temp_doc.write(document.encode("utf-8"))
|
|
||||||
temp_doc.close()
|
|
||||||
# Readability Docs: https://github.com/mozilla/readability
|
# Readability Docs: https://github.com/mozilla/readability
|
||||||
cmd = [
|
|
||||||
READABILITY_BINARY,
|
|
||||||
temp_doc.name
|
|
||||||
]
|
|
||||||
|
|
||||||
status = 'succeeded'
|
status = 'succeeded'
|
||||||
timer = TimedProgress(timeout, prefix=' ')
|
timer = TimedProgress(timeout, prefix=' ')
|
||||||
try:
|
try:
|
||||||
|
document = get_html(link, out_dir)
|
||||||
|
temp_doc = NamedTemporaryFile(delete=False)
|
||||||
|
temp_doc.write(document.encode("utf-8"))
|
||||||
|
temp_doc.close()
|
||||||
|
|
||||||
|
cmd = [
|
||||||
|
READABILITY_BINARY,
|
||||||
|
temp_doc.name
|
||||||
|
]
|
||||||
|
|
||||||
result = run(cmd, cwd=out_dir, timeout=timeout)
|
result = run(cmd, cwd=out_dir, timeout=timeout)
|
||||||
result_json = json.loads(result.stdout)
|
result_json = json.loads(result.stdout)
|
||||||
output_folder.mkdir(exist_ok=True)
|
output_folder.mkdir(exist_ok=True)
|
||||||
|
|
Loading…
Reference in a new issue