Update wrapper.py
This commit is contained in:
@@ -39,6 +39,14 @@ def save(url,UA=default_UA):
|
|||||||
archived_url = "https://web.archive.org" + archive_id
|
archived_url = "https://web.archive.org" + archive_id
|
||||||
return archived_url
|
return archived_url
|
||||||
|
|
||||||
|
def wayback_timestamp(year,month,day,hour,minute):
|
||||||
|
year = str(year)
|
||||||
|
month = str(month).zfill(2)
|
||||||
|
day = str(day).zfill(2)
|
||||||
|
hour = str(hour).zfill(2)
|
||||||
|
minute = str(minute).zfill(2)
|
||||||
|
return (year+month+day+hour+minute)
|
||||||
|
|
||||||
def near(
|
def near(
|
||||||
url,
|
url,
|
||||||
year=datetime.utcnow().strftime('%Y'),
|
year=datetime.utcnow().strftime('%Y'),
|
||||||
@@ -48,7 +56,7 @@ def near(
|
|||||||
minute=datetime.utcnow().strftime('%M'),
|
minute=datetime.utcnow().strftime('%M'),
|
||||||
UA=default_UA,
|
UA=default_UA,
|
||||||
):
|
):
|
||||||
timestamp = str(year)+str(month)+str(day)+str(hour)+str(minute)
|
timestamp = wayback_timestamp(year,month,day,hour,minute)
|
||||||
request_url = "https://archive.org/wayback/available?url=%s×tamp=%s" % (clean_url(url), str(timestamp))
|
request_url = "https://archive.org/wayback/available?url=%s×tamp=%s" % (clean_url(url), str(timestamp))
|
||||||
hdr = { 'User-Agent' : '%s' % UA }
|
hdr = { 'User-Agent' : '%s' % UA }
|
||||||
req = Request(request_url, headers=hdr)
|
req = Request(request_url, headers=hdr)
|
||||||
|
Reference in New Issue
Block a user