def __init__(self, logger=None): self.novel_data_file = 'dmzj_novel_data_full.json' # self.novel_data_file = 'dmzj_novel_data.json' self.api_novel = 'http://v2.api.dmzj.com/novel/%d.json' self.api_chapter = 'http://v2.api.dmzj.com/novel/chapter/%d.json' # 'http://v2.api.dmzj.com/novel/download/%d_%d_%d.txt'%(BookId,volume_id,chapter_id) self.api_download = 'http://v2.api.dmzj.com/novel/download/%d_%d_%d.txt' self.limit_sem_img = 10 self.limit_sem_chapter = 10 self.limit_sem_volume = 10 self.sumi = 0 self.book = None if logger is None: self.logger = getLogger() else: self.logger = logger if not os.path.exists(self.novel_data_file): raise FileNotFoundError('Can not find ' + self.novel_data_file) with open(self.novel_data_file, 'r', encoding='utf8') as f: self.novel_data = json.load(f)
from tkinter import * from tkinter.filedialog import askdirectory from tkinter import messagebox import webbrowser from base_logger import getLogger from lrc_module import Lrc import threading import time import psutil from urllib import parse import multiprocessing import platform from NeteaseLyricDownloader import NeteaseLyricDownloader logger = getLogger(__name__) # 用来修正文件规范。 def safe_filename(filename: str): # 过长的文件名 if len(filename) >= 255: extend = '.' + filename.split('.')[-1] filename = filename[:-len(extend) - 1] filename = filename + '~' + extend # 不能出现的符号 errors = r'\/:*?#"<>|' for c in errors: filename = filename.replace(c, '_') return filename
StorageClass='STANDARD', EnableMD5=False) response2 = client.put_object( Bucket=bucket, Body=(str_jump % filename).encode('gbk'), # Key=filename_md5, Key="%s.html" % (book_id, ), StorageClass='STANDARD', EnableMD5=False) logger.info("%s OK. %s %s" % (filename, str(response1), str(response2))) return 'https://light-novel-1254016670.cos.ap-guangzhou.myqcloud.com/%s' % filename # logger.info("%s OK。(No Cache.)" % (filename,)) # return data logger = base_logger.getLogger() if __name__ == '__main__': opts, args = getopt.getopt(sys.argv[1:], '-s:-e:-b', []) start = 1 end = 3000 for name, val in opts: if name == '-s': try: start = int(val) except ValueError as e: logger.error(str(e)) sys.exit() if name == '-e': try: end = int(val)
此时list长度应为1。 调试用。 -h 显示本帮助。 调用示例: wk2epub -t 1 1213 关于: https://github.com/LanceLiang2018/Wenku8ToEpub 版本: 2020/3/8 1:45 AM ''' logger = getLogger() lock = threading.Lock() if __name__ == '__main__': # wk = Wenku8ToEpub() # wk.get_book(1614) # wk.get_book(1016) # wk.get_book(1447) # print(wk.bookinfo(1)) # wk.login() # print(wk.search('云')) # print(wk.search('东云')) # print(wk.search('入间人间')) # print(wk.get_book_no_copyright(1614)) # exit()