ehentai: fix encoding and crash (closes #655,#656)
This commit is contained in:
parent
6772b4a987
commit
8b274bfa60
4 changed files with 33 additions and 12 deletions
|
|
@ -48,7 +48,7 @@ class IndexPage(BasePage):
|
|||
a = line.xpath('.//div[@class="it3"]/a')[-1]
|
||||
url = a.attrib["href"]
|
||||
title = a.text.strip()
|
||||
yield EHentaiGallery(url, title=title)
|
||||
yield EHentaiGallery(re.search('(?<=/g/)\d+/[\dabcdef]+', url).group(0), title=title)
|
||||
|
||||
class GalleryPage(BasePage):
|
||||
def image_pages(self):
|
||||
|
|
@ -60,6 +60,12 @@ class GalleryPage(BasePage):
|
|||
except IndexError:
|
||||
return None
|
||||
|
||||
def gallery_exists(self, gallery):
|
||||
if self.document.xpath("//h1"):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def fill_gallery(self, gallery):
|
||||
gallery.title = self.document.xpath("//h1[@id='gn']/text()")[0]
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue