mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-23 22:53:00 +02:00
fix urldecoding of titles
This commit is contained in:
2
index.py
2
index.py
@@ -146,7 +146,7 @@ def write_html_link_index(out_dir, link):
|
||||
'bookmarked': datetime.fromtimestamp(float(link['timestamp'])).strftime('%Y-%m-%d %H:%M'),
|
||||
'updated': datetime.fromtimestamp(float(link['updated'])).strftime('%Y-%m-%d %H:%M'),
|
||||
'archive_org': link['latest'].get('archive_org') or 'https://web.archive.org/save/{}'.format(link['url']),
|
||||
'wget': link['latest'].get('wget') or link['domain'],
|
||||
'wget': link['latest'].get('wget') or wget_output_path(link),
|
||||
}))
|
||||
|
||||
chmod_file(path)
|
||||
|
17
links.py
17
links.py
@@ -33,7 +33,7 @@ Link {
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from urllib.parse import unquote
|
||||
from html import unescape
|
||||
|
||||
from util import (
|
||||
domain,
|
||||
@@ -41,6 +41,7 @@ from util import (
|
||||
str_between,
|
||||
get_link_type,
|
||||
merge_links,
|
||||
wget_output_path,
|
||||
)
|
||||
from config import ANSI
|
||||
|
||||
@@ -54,6 +55,19 @@ def validate_links(links):
|
||||
print('[X] No links found :(')
|
||||
raise SystemExit(1)
|
||||
|
||||
for link in links:
|
||||
link['title'] = unescape(link['title'])
|
||||
link['latest'] = link.get('latest') or {}
|
||||
|
||||
if not link['latest'].get('wget'):
|
||||
link['latest']['wget'] = wget_output_path(link)
|
||||
|
||||
if not link['latest'].get('pdf'):
|
||||
link['latest']['pdf'] = wget_output_path(link)
|
||||
|
||||
if not link['latest'].get('screenshot'):
|
||||
link['latest']['screenshot'] = wget_output_path(link)
|
||||
|
||||
return list(links)
|
||||
|
||||
|
||||
@@ -86,7 +100,6 @@ def uniquefied_links(sorted_links):
|
||||
unique_timestamps = {}
|
||||
for link in unique_urls.values():
|
||||
link['timestamp'] = lowest_uniq_timestamp(unique_timestamps, link['timestamp'])
|
||||
link['title'] = unquote(link['title'])
|
||||
unique_timestamps[link['timestamp']] = link
|
||||
|
||||
return unique_timestamps.values()
|
||||
|
Reference in New Issue
Block a user