mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-14 07:04:27 -04:00
fix archive.org content-location capitalization
This commit is contained in:
parent
b926b1affc
commit
b3c93c43b2
1 changed files with 3 additions and 3 deletions
|
@ -310,11 +310,11 @@ def archive_dot_org(link_dir, link, timeout=TIMEOUT):
|
||||||
|
|
||||||
# Parse archive.org response headers
|
# Parse archive.org response headers
|
||||||
headers = result.stdout.splitlines()
|
headers = result.stdout.splitlines()
|
||||||
content_location = [h for h in headers if b'Content-Location: ' in h]
|
content_location = [h for h in headers if b'content-location: ' in h]
|
||||||
errors = [h for h in headers if h and b'X-Archive-Wayback-Runtime-Error: ' in h]
|
errors = [h for h in headers if h and b'X-Archive-Wayback-Runtime-Error: ' in h]
|
||||||
|
|
||||||
if content_location:
|
if content_location:
|
||||||
archive_path = content_location[0].split(b'Content-Location: ', 1)[-1].decode('utf-8')
|
archive_path = content_location[0].split(b'content-location: ', 1)[-1].decode('utf-8')
|
||||||
saved_url = 'https://web.archive.org{}'.format(archive_path)
|
saved_url = 'https://web.archive.org{}'.format(archive_path)
|
||||||
success = True
|
success = True
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ def archive_dot_org(link_dir, link, timeout=TIMEOUT):
|
||||||
elif errors:
|
elif errors:
|
||||||
raise Exception(', '.join(e.decode() for e in errors))
|
raise Exception(', '.join(e.decode() for e in errors))
|
||||||
else:
|
else:
|
||||||
raise Exception('Failed to find "Content-Location" URL header in Archive.org response.')
|
raise Exception('Failed to find "content-location" URL header in Archive.org response.')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
end()
|
end()
|
||||||
print(' Visit url to see output:', ' '.join(CMD))
|
print(' Visit url to see output:', ' '.join(CMD))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue