diff --git a/weibo_spider/parser/page_parser.py b/weibo_spider/parser/page_parser.py index fcd1714..6e35644 100644 --- a/weibo_spider/parser/page_parser.py +++ b/weibo_spider/parser/page_parser.py @@ -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