summaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/importers/wayback_static.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_tools/importers/wayback_static.py')
-rwxr-xr-xpython/fatcat_tools/importers/wayback_static.py11
1 files changed, 1 insertions, 10 deletions
diff --git a/python/fatcat_tools/importers/wayback_static.py b/python/fatcat_tools/importers/wayback_static.py
index fa0bd4ef..5b23347f 100755
--- a/python/fatcat_tools/importers/wayback_static.py
+++ b/python/fatcat_tools/importers/wayback_static.py
@@ -8,7 +8,6 @@ Works as a stand-alone script (for debugging) or as library routines.
import sys
import json
-import base64
import hashlib
import requests
import datetime
@@ -17,21 +16,13 @@ import subprocess
from bs4 import BeautifulSoup
from fatcat_openapi_client import *
+from .common import b32_hex
CDX_API_BASE = "https://web.archive.org/cdx/search/cdx"
GWB_URL_BASE = "https://web.archive.org/web"
REQ_SESSION = requests.Session()
-def b32_hex(s):
- """copy/pasta from elsewhere"""
- s = s.strip().split()[0].lower()
- if s.startswith("sha1:"):
- s = s[5:]
- if len(s) != 32:
- return s
- return base64.b16encode(base64.b32decode(s.upper())).lower().decode('utf-8')
-
def parse_wbm_url(url):
"""Takes a wayback machine URL, and returns a tuple: