Skip to content

Commit

Permalink
Merge pull request mvdctop#979 from WarpTraveller/master
Browse files Browse the repository at this point in the history
Fix a type error and optimize the method.
  • Loading branch information
mvdctop authored Mar 4, 2023
2 parents d052cb5 + b937e9b commit 64de6c5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions scrapinglib/fanza.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,13 @@ def search(self, number):
self.detailurl = url + fanza_search_number
url = "https://www.dmm.co.jp/age_check/=/declared=yes/?"+ urlencode({"rurl": self.detailurl})
self.htmlcode = self.getHtml(url)
if "Sorry! This content is not available in your region." in self.htmlcode:
continue
if self.htmlcode != 404:
if self.htmlcode != 404 \
and 'Sorry! This content is not available in your region.' not in self.htmlcode:
self.htmltree = etree.HTML(self.htmlcode)
break
if self.htmlcode == 404:
return 404
result = self.dictformat(self.htmltree)
return result
if self.htmltree is not None:
result = self.dictformat(self.htmltree)
return result
return 404

def getNum(self, htmltree):
# for some old page, the input number does not match the page
Expand Down

0 comments on commit 64de6c5

Please sign in to comment.