本文整理汇总了Python中Analyzer.Analyzer.get_author_detail方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer.get_author_detail方法的具体用法?Python Analyzer.get_author_detail怎么用?Python Analyzer.get_author_detail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer.get_author_detail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: poem_author_crew
# 需要导入模块: from Analyzer import Analyzer [as 别名]
# 或者: from Analyzer.Analyzer import get_author_detail [as 别名]
def poem_author_crew(self):
# 一条一条取
total_count = 20000
i = 0
while i < total_count:
i += 1
# 去除诗词的详情页url
authors = self.db.select_authors()
cou = len(authors)
i = 1
for author in authors:
url = author[0]
if url is not None and url is not '':
# 判断是否存在
if not self.db.author_exists(url):
html = Downloader.get_html(url, 'author')
if html:
try:
author_info = Analyzer.get_author_detail(html, url)
if author_info:
author_content = author_info[0]
author_infos = author_info[1]
self.db.insert_author(author_content)
self.db.insert_infomations(url, 2, author_infos)
print '%d/%d %s %s' % (i, cou, author_content['name'], url)
i += 1
else:
self.db.insert_error('analyze_author_detail_error', 9, 'reason', url)
except Exception, e:
print 'error %s' % (url,)
else:
self.db.insert_error('download_author_detail_error', 8, 'reason', url)
else:
# 没有了
return