From 09a68dc0f0008b513b03621d15c483bbb6f5bc29 Mon Sep 17 00:00:00 2001 From: garret Date: Wed, 12 Jul 2023 16:25:49 +0100 Subject: use the nice features that make life easier --- walker.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'walker.py') diff --git a/walker.py b/walker.py index 9c626fa..d98be8f 100644 --- a/walker.py +++ b/walker.py @@ -17,7 +17,7 @@ if args.cid == None: sys.exit() def start(url, headers): - meta = json.loads(requests.get(url=url, headers=headers).content) + meta = requests.get(url=url, headers=headers).json() img_url = f'{url}/frames?enable_webp=true' try: @@ -36,7 +36,7 @@ def start(url, headers): undrm(img_url, headers, cid_info) def undrm(url, headers, cid_info): - meta = json.loads(requests.get(url=url, headers=headers).content) + meta = requests.get(url=url, headers=headers).json() print('Page count: {}\n'.format(len(meta['data']['result']))) @@ -67,8 +67,8 @@ def undrm(url, headers, cid_info): def xor(bin, key): retval = [] - for i in range(len(bin)): - retval.append(bin[i] ^ key[i % len(key)]) + for idx, val in enumerate(bin): + retval.append(val ^ key[idx % len(key)]) return bytes(retval) -- cgit v1.2.3-70-g09d2