From d83cc4ef41104abc1b504e49f3dd53f84769c911 Mon Sep 17 00:00:00 2001 From: garret Date: Wed, 12 Jul 2023 17:05:44 +0100 Subject: -nolog -> -v/--verbose make more logs a thing you opt into rather than something you opt out of also actually fixed the logging that i broke by getting rid of colourlog --- walker.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'walker.py') diff --git a/walker.py b/walker.py index 42b9793..f32a6e7 100644 --- a/walker.py +++ b/walker.py @@ -9,13 +9,15 @@ from binascii import unhexlify parser = argparse.ArgumentParser() parser.add_argument('-cid', help='content id, &cid={...}. see url when reading a chapter') -parser.add_argument('-nolog', help='no progressive download logs on terminal', action="store_true") +parser.add_argument('-v', '--verbose', help='no progressive download logs on terminal', action="store_true") args = parser.parse_args() if args.cid == None: parser.print_help() sys.exit() +logging.basicConfig(format='[%(levelname)s] %(asctime)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S', level=logging.INFO) + def start(url, headers): meta = requests.get(url=url, headers=headers).json() img_url = f'{url}/frames?enable_webp=true' @@ -49,11 +51,8 @@ def undrm(url, headers, cid_info): for num, page in enumerate(meta['data']['result']): - if args.nolog: - if page == 1: - logging.info('DL in progress...') - else: - logging.info('Progress: page ' + str(page)) + if args.verbose: + logging.info(f'Downloading page {num+1}') key = page['meta']['drm_hash'] file = requests.get(page['meta']['source_url'], headers=headers).content -- cgit v1.2.3-70-g09d2