本文整理汇总了Python中analyzer.Analyzer.get_relation_pagenum方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer.get_relation_pagenum方法的具体用法?Python Analyzer.get_relation_pagenum怎么用?Python Analyzer.get_relation_pagenum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer.get_relation_pagenum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_based_follownum
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import get_relation_pagenum [as 别名]
def parse_based_follownum(self,response):
item = WeibospiderItem()
analyzer = Analyzer()
total_follow_pq = analyzer.get_childfollowhtml(response.body)
follow_page_num = analyzer.get_relation_pagenum(total_follow_pq)
if follow_page_num != "" and int(follow_page_num) >= 5:
for page in range(5,0,-1):
GetWeibopage.relation_data['page'] = page
follow_url = getinfo.get_follow_mainurl(response.meta['uid']) + WeiboSpider.getweibopage.get_relation_paramurl()
yield Request(url=follow_url,meta={'cookiejar':response.meta['cookiejar'],'uid':response.meta['uid']},callback=self.parse_follow)
elif follow_page_num == "":
follow_url = 'http://weibo.com/%s/follow?page=1' % response.meta['uid']
yield Request(url=follow_url,meta={'cookiejar':1,'uid':response.meta['uid']},callback=self.parse_follow)
else:
for page in range(int(follow_page_num),0,-1):
GetWeibopage.relation_data['page'] = page
follow_url = getinfo.get_follow_mainurl(response.meta['uid']) + WeiboSpider.getweibopage.get_relation_paramurl()
yield Request(url=follow_url,meta={'cookiejar':response.meta['cookiejar'],'uid':response.meta['uid']},callback=self.parse_follow)