Get unmodified HTML from the wayback machine

This commit is contained in:
Kovid Goyal 2022-09-14 19:50:28 +05:30
parent 1f38680cb5
commit d5d577a0a2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -140,7 +140,10 @@ def wayback_machine_cached_url(url, br=None, log=prints, timeout=60):
try:
closest = data['archived_snapshots']['closest']
if closest['available']:
return closest['url'].replace('http:', 'https:')
ans = closest['url'].replace('http:', 'https:', 1)
# get unmodified HTML
ans = ans.replace(closest['timestamp'], closest['timestamp'] + 'id_', 1)
return ans
except Exception:
pass
from pprint import pformat