|
|
@ -115,12 +115,14 @@ class Publications(Bureau):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
shortcode, _ = data.split(".")
|
|
|
|
shortcode, _ = data.split(".")
|
|
|
|
with self.dbenv.begin(db=self.urldb) as txn:
|
|
|
|
with self.dbenv.begin(db=self.urldb) as txn:
|
|
|
|
print("looking up short-code:", shortcode)
|
|
|
|
self.log.debug("looking up short-code:" + shortcode)
|
|
|
|
url = txn.get(shortcode.encode('utf-8')).decode()
|
|
|
|
url = txn.get(shortcode.encode('utf-8'))
|
|
|
|
|
|
|
|
|
|
|
|
if not url:
|
|
|
|
if not url:
|
|
|
|
print("ERROR: no valid URL in db for short code: ", shortcode)
|
|
|
|
self.log.warning("no valid URL in db for short code: " + shortcode)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
url = url.decode()
|
|
|
|
|
|
|
|
|
|
|
|
# download
|
|
|
|
# download
|
|
|
|
headers = {'User-Agent': 'Mozilla/5.0'}
|
|
|
|
headers = {'User-Agent': 'Mozilla/5.0'}
|
|
|
|