mirror of
				https://github.com/RicterZ/nhentai.git
				synced 2025-10-31 09:39:34 +01:00 
			
		
		
		
	fix extension issue #44
This commit is contained in:
		| @@ -59,8 +59,11 @@ class Doujinshi(object): | |||||||
|         if self.downloader: |         if self.downloader: | ||||||
|             download_queue = [] |             download_queue = [] | ||||||
|  |  | ||||||
|             for i in range(1, self.pages + 1): |             if len(self.ext) != self.pages: | ||||||
|                 download_queue.append('%s/%d/%d.%s' % (IMAGE_URL, int(self.img_id), i, self.ext)) |                 logger.warning('Page count and ext count do not equal') | ||||||
|  |  | ||||||
|  |             for i in range(1, min(self.pages, len(self.ext)) + 1): | ||||||
|  |                 download_queue.append('%s/%d/%d.%s' % (IMAGE_URL, int(self.img_id), i, self.ext[i-1])) | ||||||
|  |  | ||||||
|             self.downloader.download(download_queue, self.filename) |             self.downloader.download(download_queue, self.filename) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -115,12 +115,18 @@ def doujinshi_parser(id_): | |||||||
|  |  | ||||||
|     doujinshi_cover = html.find('div', attrs={'id': 'cover'}) |     doujinshi_cover = html.find('div', attrs={'id': 'cover'}) | ||||||
|     img_id = re.search('/galleries/([\d]+)/cover\.(jpg|png)$', doujinshi_cover.a.img.attrs['data-src']) |     img_id = re.search('/galleries/([\d]+)/cover\.(jpg|png)$', doujinshi_cover.a.img.attrs['data-src']) | ||||||
|  |  | ||||||
|  |     ext = [] | ||||||
|  |     for i in html.find_all('div', attrs={'class': 'thumb-container'}): | ||||||
|  |         _, ext_name = os.path.basename(i.img.attrs['data-src']).rsplit('.', 1) | ||||||
|  |         ext.append(ext_name) | ||||||
|  |  | ||||||
|     if not img_id: |     if not img_id: | ||||||
|         logger.critical('Tried yo get image id failed') |         logger.critical('Tried yo get image id failed') | ||||||
|         exit(1) |         exit(1) | ||||||
|  |  | ||||||
|     doujinshi['img_id'] = img_id.group(1) |     doujinshi['img_id'] = img_id.group(1) | ||||||
|     doujinshi['ext'] = img_id.group(2) |     doujinshi['ext'] = ext | ||||||
|  |  | ||||||
|     pages = 0 |     pages = 0 | ||||||
|     for _ in doujinshi_info.find_all('div', class_=''): |     for _ in doujinshi_info.find_all('div', class_=''): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user