Skip to content
Commits on Source (3)
V 0.3.1:
- Fixes the program crashing when attempting to download chapters that aren't available yet
V 0.3.0:
- Various fixes to the mechanism that bundles chapters
V 0.2.0:
......
......@@ -21,11 +21,11 @@ import os
import shutil
import logging
import cfscrape
import requests
from puffotter.os import makedirs
from typing import Callable, List
from typing import Optional
from subprocess import Popen, DEVNULL
from urllib.request import urlretrieve
class Chapter:
......@@ -207,9 +207,21 @@ class Chapter:
with open(image_file, "wb") as f:
f.write(content)
else:
urlretrieve(image_url, image_file)
resp = requests.get(
image_url, headers={"User-Agent": "Mozilla/5.0"}
)
if resp.status_code >= 300:
self.logger.warning("Couldn't download image file {}"
.format(image_file))
else:
with open(image_file, "wb") as f:
f.write(resp.content)
downloaded.append(image_file)
if len(downloaded) == 0:
self.logger.warning("Couldn't download chapter {}".format(self))
else:
if _format in ["cbz", "zip"]:
self.logger.debug("Zipping Files")
Popen(["zip", "-j", dest_path] + downloaded,
......
0.3.0
\ No newline at end of file
0.3.1
\ No newline at end of file