Skip to content

Commit

Permalink
Fix a type error and optimize the method.
Browse files Browse the repository at this point in the history
  • Loading branch information
BrainHeaps committed Feb 27, 2023
1 parent d052cb5 commit b937e9b
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 b937e9b

Please sign in to comment.