Skip to content

Commit

Permalink
Merge pull request #583 from zangwill/patch-1
Browse files Browse the repository at this point in the history
解决 'NoneType' object has no attribute 'xpath'
  • Loading branch information
dataabc committed May 17, 2024
2 parents 287e93f + e94535b commit 48328d1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions weibo_spider/parser/page_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ def __init__(self, cookie, user_config, page, filter):
is_exist = ''
for i in range(3):
self.selector = handle_html(self.cookie, self.url)
info = self.selector.xpath("//div[@class='c']")
if info is None or len(info) == 0:
continue
is_exist = info[0].xpath("div/span[@class='ctt']")
if self.selector:
info = self.selector.xpath("//div[@class='c']")
if info is None or len(info) == 0:
continue
is_exist = info[0].xpath("div/span[@class='ctt']")
if is_exist:
PageParser.empty_count = 0
break
Expand Down

0 comments on commit 48328d1

Please sign in to comment.