Merge pull request #979 from WarpTraveller/master

Fix a type error and optimize the method.
This commit is contained in:
Yoshiko2
2023-03-05 00:21:11 +08:00
committed by GitHub

View File

@@ -49,15 +49,13 @@ class Fanza(Parser):
self.detailurl = url + fanza_search_number self.detailurl = url + fanza_search_number
url = "https://www.dmm.co.jp/age_check/=/declared=yes/?"+ urlencode({"rurl": self.detailurl}) url = "https://www.dmm.co.jp/age_check/=/declared=yes/?"+ urlencode({"rurl": self.detailurl})
self.htmlcode = self.getHtml(url) self.htmlcode = self.getHtml(url)
if "Sorry! This content is not available in your region." in self.htmlcode: if self.htmlcode != 404 \
continue and 'Sorry! This content is not available in your region.' not in self.htmlcode:
if self.htmlcode != 404:
self.htmltree = etree.HTML(self.htmlcode) self.htmltree = etree.HTML(self.htmlcode)
break if self.htmltree is not None:
if self.htmlcode == 404: result = self.dictformat(self.htmltree)
return 404 return result
result = self.dictformat(self.htmltree) return 404
return result
def getNum(self, htmltree): def getNum(self, htmltree):
# for some old page, the input number does not match the page # for some old page, the input number does not match the page