diff options
author | garret <garret@airmail.cc> | 2023-07-12 18:14:05 +0100 |
---|---|---|
committer | garret <garret@airmail.cc> | 2023-07-13 08:06:22 +0100 |
commit | 37dcb4da77f96ebf86061b5c88ea2d1b212b1372 (patch) | |
tree | 3afde9ae9a91661f6f91f92304b14c34ab72f849 /walker.py | |
parent | e68df40ca3aca72c7e354d8a46aa4b9b7e91f358 (diff) | |
download | comicwalker-dl-37dcb4da77f96ebf86061b5c88ea2d1b212b1372.tar.gz comicwalker-dl-37dcb4da77f96ebf86061b5c88ea2d1b212b1372.tar.bz2 comicwalker-dl-37dcb4da77f96ebf86061b5c88ea2d1b212b1372.zip |
fix error if page is not scrambled
Diffstat (limited to 'walker.py')
-rw-r--r-- | walker.py | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -47,7 +47,7 @@ def undrm(url, headers, cid_info): print(f'Saving chapter to {save_path}\n')
- for page in range(1, len(meta['data']['result']) + 1):
+ for num, page in enumerate(meta['data']['result']):
if args.nolog:
if page == 1:
@@ -55,12 +55,16 @@ def undrm(url, headers, cid_info): else:
logging.info('Progress: page ' + str(page))
- key = unhexlify(meta['data']['result'][page-1]['meta']['drm_hash'][:16])
- enc = requests.get(meta['data']['result'][page-1]['meta']['source_url'], headers=headers).content
- pagination = str(page) + '.webp'
+ key = page['meta']['drm_hash']
+ file = requests.get(page['meta']['source_url'], headers=headers).content
+ pagination = str(num + 1) + '.webp'
+
+ if key is not None:
+ key = unhexlify(key[:16])
+ file = xor(file, key)
with open(f'{save_path}/{pagination}', 'wb') as f:
- f.write(xor(enc, key))
+ f.write(file)
logging.info('Done.')
|