mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 12:26:19 -05:00
Decoding singlefile.
This commit is contained in:
parent
c921fdc33c
commit
7a4524fc8f
1 changed files with 6 additions and 4 deletions
|
|
@ -92,22 +92,24 @@ def request_archive(url: str):
|
|||
except Exception as e:
|
||||
logger.error('Error when requesting archive', exc_info=e)
|
||||
raise
|
||||
singlefile = resp.json()['singlefile']
|
||||
readability = resp.json()['readability']
|
||||
# Compressed base64
|
||||
singlefile = resp.json()['singlefile']
|
||||
screenshot = resp.json()['screenshot']
|
||||
|
||||
if not (screenshot or singlefile or readability):
|
||||
raise Exception('singlefile response was empty!')
|
||||
|
||||
if not readability:
|
||||
logger.info(f'Failed to get readability for {url=}')
|
||||
|
||||
if not singlefile:
|
||||
logger.info(f'Failed to get singlefile for {url=}')
|
||||
else:
|
||||
# Decode and decompress.
|
||||
singlefile = base64.b64decode(singlefile)
|
||||
singlefile = gzip.decompress(singlefile)
|
||||
|
||||
if not readability:
|
||||
logger.info(f'Failed to get readability for {url=}')
|
||||
singlefile = singlefile.decode()
|
||||
|
||||
if not screenshot:
|
||||
logger.info(f'Failed to get screenshot for {url=}')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue