本文整理汇总了Python中analyzer.Analyzer.get_userphoto_url方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer.get_userphoto_url方法的具体用法?Python Analyzer.get_userphoto_url怎么用?Python Analyzer.get_userphoto_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer.get_userphoto_url方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_user_info
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import get_userphoto_url [as 别名]
def get_user_info(self,response):
item =WeibospiderItem()
item['uid'] = response.meta['user_id']
analyzer = Analyzer()
keyword_analyzer = keyword_info_analyzer()
total_pq1 = analyzer.get_html(response.body,'script:contains("pf_photo")')
item['image_urls'] = analyzer.get_userphoto_url(total_pq1) + "?uid=" + str(response.meta['user_id'])
total_pq2 = analyzer.get_html(response.body,'script:contains("PCD_text_b")')
total_pq3 = analyzer.get_html(response.body,'script:contains("PCD_counter")')
item['userinfo'] = analyzer.get_userinfo(total_pq2,total_pq3)
# logger.info(item)
yield item
示例2: parse_public_userinfo
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import get_userphoto_url [as 别名]
def parse_public_userinfo(self,response):
'''解析公众账号个人信息'''
item = WeibospiderItem()
analyzer = Analyzer()
try:
total_pq1 = analyzer.get_html(response.body,'script:contains("pf_photo")')
item['image_urls'] = analyzer.get_userphoto_url(total_pq1)
total_pq2 = analyzer.get_html(response.body,'script:contains("PCD_text_b")')
item['userinfo'] = analyzer.get_public_userinfo(total_pq2)
except Exception,e:
item['userinfo'] = {}.fromkeys(('联系人:'.decode('utf-8'),'电话:'.decode('utf-8'),'>邮箱:'.decode('utf-8'),'友情链接:'.decode('utf-8')),'')
item['image_urls'] = None
示例3: parse_userinfo
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import get_userphoto_url [as 别名]
def parse_userinfo(self,response):
'''解析非公众账号个人信息'''
item = WeibospiderItem()
analyzer = Analyzer()
try:
total_pq1 = analyzer.get_html(response.body,'script:contains("pf_photo")')
item['image_urls'] = analyzer.get_userphoto_url(total_pq1)
total_pq2 = analyzer.get_html(response.body,'script:contains("PCD_text_b")')
item['userinfo'] = analyzer.get_userinfo(total_pq2)
except Exception,e:
item['userinfo'] = {}.fromkeys(('昵称:'.decode('utf-8'),'所在地:'.decode('utf-8'),'性别:'.decode('utf-8'),'博客:'.decode('utf-8'),'个性域名:'. decode('utf-8'),'简介:'.decode('utf-8'),'生日:'.decode('utf-8'),'注册时间:'.decode('utf-8')),'')
item['image_urls'] = None
示例4: parse_userinfo
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import get_userphoto_url [as 别名]
def parse_userinfo(self,response):
'''解析非公众账号个人信息 '''
item = WeibospiderItem()
analyzer = Analyzer()
try:
total_pq1 = analyzer.get_html(response.body,'script:contains("pf_photo")')
item['image_urls'] = analyzer.get_userphoto_url(total_pq1) + "?uid=" + str(response.meta['uid'])
#item['image_urls'] = None
total_pq2 = analyzer.get_html(response.body,'script:contains("PCD_text_b")')
total_pq3 = analyzer.get_html(response.body,'script:contains("PCD_counter")')
if response.meta['is_friend'] == 0: #此时用于获取主用户基本信息,而非朋友圈用户基本信息
item['userinfo'] = analyzer.get_userinfo(total_pq2,total_pq3)
elif response.meta['is_friend'] == 1: #此时用于获取@用户基本信息
item['atuser_userinfo'] = analyzer.get_userinfo(total_pq2,total_pq3)
else: #此时用于获取转发用户基本信息
item['repostuser_userinfo'] = analyzer.get_userinfo(total_pq2,total_pq3)
except Exception,e:
item['userinfo'] = {}.fromkeys(('昵称:'.decode('utf-8'),'所在地:'.decode('utf-8'),'性别:'.decode('utf-8'),'博客:'.decode('utf-8'),'个性域名:'.decode('utf-8'),'简介:'.decode('utf-8'),'生日:'.decode('utf-8'),'注册时间:'.decode('utf-8'),'follow_num','follower_num'),'')
item['atuser_userinfo'] = item['userinfo']
item['repostuser_userinfo'] = item['userinfo']
item['image_urls'] = None