-
Notifications
You must be signed in to change notification settings - Fork 20
/
comicbook.py
37 lines (30 loc) · 889 Bytes
/
comicbook.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# coding: UTF-8
import json
import argparse
import logging
from crawler import Crawler
logging.basicConfig(level=logging.INFO)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="comicbook")
parser.add_argument(
"-c",
"--comic",
required=True,
help="a comic link on nhentai.net, e-hentai.org, wnacg.com",
)
parser.add_argument(
"-f",
"--format",
default="epub",
choices=["epub", "cbz"],
help="Specify a format.",
)
parser.add_argument("-o", "--output", help="Specify a output path.")
args = parser.parse_args()
if args.output:
result = Crawler.download_manually(args.comic, args.format, args.output)
print(result)
else:
result = Crawler.download(args.comic)
result.pop("item")
print(json.dumps(result, indent=2))