mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-19 18:31:24 +02:00
Merge pull request #4 from navrudh/patch-1
Padding filenames with width 3
This commit is contained in:
commit
5bb98aa007
@ -26,8 +26,9 @@ class Downloader(object):
|
||||
def _download(self, url, folder='', filename='', retried=False):
|
||||
logger.info('Start downloading: {0} ...'.format(url))
|
||||
filename = filename if filename else os.path.basename(urlparse(url).path)
|
||||
base_filename, extension = os.path.splitext(filename)
|
||||
try:
|
||||
with open(os.path.join(folder, filename), "wb") as f:
|
||||
with open(os.path.join(folder, base_filename.zfill(3) + extension), "wb") as f:
|
||||
response = request('get', url, stream=True, timeout=self.timeout)
|
||||
length = response.headers.get('content-length')
|
||||
if length is None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user