From 52b4bb9ac7bce71bcfeef4b475a65a36e929abee Mon Sep 17 00:00:00 2001 From: akamhy <64683866+akamhy@users.noreply.github.com> Date: Mon, 4 May 2020 08:21:42 +0530 Subject: [PATCH] Update wrapper.py --- waybackpy/wrapper.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/waybackpy/wrapper.py b/waybackpy/wrapper.py index 9d3e7c9..4a05d96 100644 --- a/waybackpy/wrapper.py +++ b/waybackpy/wrapper.py @@ -26,7 +26,8 @@ class PageNotSavedError(Exception): class InvalidUrlError(Exception): """ - When the inpute url doesn't have '.' in it. + Files like robots.txt are set to deny robot archiving. + Wayback machine respects these file, will not archive. """ def save(url,UA=default_UA): @@ -68,15 +69,14 @@ def near( encoding = response.info().get_content_charset('utf8') import json data = json.loads(response.read().decode(encoding)) - print(data) if not data["archived_snapshots"]: raise PageNotSavedError("'%s' was not archived." % url) archive_url = (data["archived_snapshots"]["closest"]["url"]) return archive_url -def oldest(url,UA=default_UA): - return near(url,year=1995,UA=UA) +def oldest(url,UA=default_UA,year=1994): + return near(url,year=year,UA=UA) def newest(url,UA=default_UA): return near(url,UA=UA)