| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,30 +45,30 @@ | |||
| 45 | 45 | chapter_save_dir = os.path.join(save_dir, name) | |
| 46 | 46 | if name not in os.listdir(save_dir): | |
| 47 | 47 | os.mkdir(chapter_save_dir) | |
| 48 | - r = requests.get(url = url) | ||
| 49 | - html = BeautifulSoup(r.text, 'lxml') | ||
| 50 | - script_info = html.script | ||
| 51 | - pics = re.findall('\d{13,14}', str(script_info)) | ||
| 52 | - for j, pic in enumerate(pics): | ||
| 53 | - if len(pic) == 13: | ||
| 54 | - pics[j] = pic + '0' | ||
| 55 | - pics = sorted(pics, key=lambda x:int(x)) | ||
| 56 | - chapterpic_hou = re.findall('\|(\d{5})\|', str(script_info))[0] | ||
| 57 | - chapterpic_qian = re.findall('\|(\d{4})\|', str(script_info))[0] | ||
| 58 | - for idx, pic in enumerate(pics): | ||
| 59 | - if pic[-1] == '0': | ||
| 60 | - url = 'https://images.dmzj.com/img/chapterpic/' + chapterpic_qian + '/' + chapterpic_hou + '/' + pic[:-1] + '.jpg' | ||
| 48 | + r = requests.get(url = url) | ||
| 49 | + html = BeautifulSoup(r.text, 'lxml') | ||
| 50 | + script_info = html.script | ||
| 51 | + pics = re.findall('\d{13,14}', str(script_info)) | ||
| 52 | + for j, pic in enumerate(pics): | ||
| 53 | + if len(pic) == 13: | ||
| 54 | + pics[j] = pic + '0' | ||
| 55 | + pics = sorted(pics, key=lambda x:int(x)) | ||
| 56 | + chapterpic_hou = re.findall('\|(\d{5})\|', str(script_info))[0] | ||
| 57 | + chapterpic_qian = re.findall('\|(\d{4})\|', str(script_info))[0] | ||
| 58 | + for idx, pic in enumerate(pics): | ||
| 59 | + if pic[-1] == '0': | ||
| 60 | + url = 'https://images.dmzj.com/img/chapterpic/' + chapterpic_qian + '/' + chapterpic_hou + '/' + pic[:-1] + '.jpg' | ||
| 61 | + else: | ||
| 62 | + url = 'https://images.dmzj.com/img/chapterpic/' + chapterpic_qian + '/' + chapterpic_hou + '/' + pic + '.jpg' | ||
| 63 | + pic_name = '%03d.jpg' % (idx + 1) | ||
| 64 | + pic_save_path = os.path.join(chapter_save_dir, pic_name) | ||
| 65 | + with closing(requests.get(url, headers = download_header, stream = True)) as response: | ||
| 66 | + chunk_size = 1024 | ||
| 67 | + content_size = int(response.headers['content-length']) | ||
| 68 | + if response.status_code == 200: | ||
| 69 | + with open(pic_save_path, "wb") as file: | ||
| 70 | + for data in response.iter_content(chunk_size=chunk_size): | ||
| 71 | + file.write(data) | ||
| 61 | 72 | else: | |
| 62 | - url = 'https://images.dmzj.com/img/chapterpic/' + chapterpic_qian + '/' + chapterpic_hou + '/' + pic + '.jpg' | ||
| 63 | - pic_name = '%03d.jpg' % (idx + 1) | ||
| 64 | - pic_save_path = os.path.join(chapter_save_dir, pic_name) | ||
| 65 | - with closing(requests.get(url, headers = download_header, stream = True)) as response: | ||
| 66 | - chunk_size = 1024 | ||
| 67 | - content_size = int(response.headers['content-length']) | ||
| 68 | - if response.status_code == 200: | ||
| 69 | - with open(pic_save_path, "wb") as file: | ||
| 70 | - for data in response.iter_content(chunk_size=chunk_size): | ||
| 71 | - file.write(data) | ||
| 72 | - else: | ||
| 73 | - print('链接异常') | ||
| 74 | - time.sleep(10) | ||
| 73 | + print('链接异常') | ||
| 74 | + time.sleep(10) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments