aboutsummaryrefslogtreecommitdiffstats
path: root/walker.py
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2023-07-12 17:05:44 +0100
committergarret <garret@airmail.cc>2023-07-13 08:06:22 +0100
commitd83cc4ef41104abc1b504e49f3dd53f84769c911 (patch)
tree535c8ee8bcf40abc1dfdb4dd5cfb4e340ba0382d /walker.py
parent37dcb4da77f96ebf86061b5c88ea2d1b212b1372 (diff)
downloadcomicwalker-dl-d83cc4ef41104abc1b504e49f3dd53f84769c911.tar.gz
comicwalker-dl-d83cc4ef41104abc1b504e49f3dd53f84769c911.tar.bz2
comicwalker-dl-d83cc4ef41104abc1b504e49f3dd53f84769c911.zip
-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
Diffstat (limited to 'walker.py')
-rw-r--r--walker.py11
1 files changed, 5 insertions, 6 deletions
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