Skip to content

Incredibly fast crawler designed for OSINT.

Dynamic time range for archive.org (Resolves #103)

Somdev Sangwan97b5ec635aa9
diff --git a/plugins/wayback.py b/plugins/wayback.py
index 6827bce..d15942f 100644
--- a/plugins/wayback.py
+++ b/plugins/wayback.py
@@ -1,4 +1,5 @@
"""Support for archive.org."""
+import datetime
import json
from requests import get
@@ -6,7 +7,13 @@ from requests import get
def time_machine(host, mode):
"""Query archive.org."""
- url = "http://web.archive.org/cdx/search?url=%s&matchType=%s&collapse=urlkey&fl=original&filter=mimetype:text/html&filter=statuscode:200&output=json&from=20180101&to=20181231" % (host, mode)
+ now = datetime.datetime.now()
+ to = str(now.year) + str(now.day) + str(now.month)
+ if now.month > 6:
+ fro = str(now.year) + str(now.day) + str(now.month - 6)
+ else:
+ fro = str(now.year - 1) + str(now.day) + str(now.month + 6)
+ url = "http://web.archive.org/cdx/search?url=%s&matchType=%s&collapse=urlkey&fl=original&filter=mimetype:text/html&filter=statuscode:200&output=json&from=%s&to=%s" % (host, mode, fro, to)
response = get(url).text
parsed = json.loads(response)[1:]
urls = []