本文整理汇总了Python中scraper.Scraper.save_newest_items方法的典型用法代码示例。如果您正苦于以下问题:Python Scraper.save_newest_items方法的具体用法?Python Scraper.save_newest_items怎么用?Python Scraper.save_newest_items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scraper.Scraper
的用法示例。
在下文中一共展示了Scraper.save_newest_items方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: every_1_min
# 需要导入模块: from scraper import Scraper [as 别名]
# 或者: from scraper.Scraper import save_newest_items [as 别名]
def every_1_min():
minute = datetime.utcnow().minute
s = Scraper()
s.connect()
if minute % 2 == 0:
# print "2 MIN"
# Update scores of newest existing stories
s.save_newest_existing_stories(count=30, min_delay=90)
if minute % 10 == 0:
# print "10 MIN"
# Update scores of stories on pages 2 and of newest
s.save_newest_existing_stories(start_from=30, count=60, min_delay=5*60)
# Update scores of stories on pages 2 and 3 of front page
s.save_top_stories(front_page=False, start_from=30, count=60, min_delay=5*60)
if minute % 5 == 0:
# print "5 MIN"
# Discover latest items
s.save_newest_items()
# Update scores of front page
s.save_top_stories(front_page=True, count=30, min_delay=3*60)
示例2: init
# 需要导入模块: from scraper import Scraper [as 别名]
# 或者: from scraper.Scraper import save_newest_items [as 别名]
def init():
s = Scraper()
s.connect()
s.save_newest_items()