本文整理汇总了Python中spider.Spider.crawl_page方法的典型用法代码示例。如果您正苦于以下问题:Python Spider.crawl_page方法的具体用法?Python Spider.crawl_page怎么用?Python Spider.crawl_page使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spider.Spider
的用法示例。
在下文中一共展示了Spider.crawl_page方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: work
# 需要导入模块: from spider import Spider [as 别名]
# 或者: from spider.Spider import crawl_page [as 别名]
def work():
print('main.py/work()')
while True:
url=queue.get()
Spider.crawl_page(threading.current_thread().name,url)
queue.task_done()
print('main.py/work()/end')
示例2: work
# 需要导入模块: from spider import Spider [as 别名]
# 或者: from spider.Spider import crawl_page [as 别名]
def work():
while True:
item = thread_queue.get()
url = item['url']
distance = item['distance']
Spider.crawl_page(threading.current_thread().name, url, distance)
thread_queue.task_done()
示例3: work
# 需要导入模块: from spider import Spider [as 别名]
# 或者: from spider.Spider import crawl_page [as 别名]
def work():
while True:
url = queue.get()
table_name = 'url_title_rel'
title = Spider.crawl_page(threading.current_thread().name, url, DB_FILE_PATH, table_name)
#print title
queue.task_done()
示例4: work
# 需要导入模块: from spider import Spider [as 别名]
# 或者: from spider.Spider import crawl_page [as 别名]
def work():
while True:
url=queue.get()
Spider.crawl_page(threading.current_thread().name,url)
queue.task.done()
示例5: spider
# 需要导入模块: from spider import Spider [as 别名]
# 或者: from spider.Spider import crawl_page [as 别名]
def spider(domain, url, depth):
"""爬虫测试"""
spider_engine = Spider(domain)
spider_engine.crawl_page([url], depth)
示例6: work
# 需要导入模块: from spider import Spider [as 别名]
# 或者: from spider.Spider import crawl_page [as 别名]
def work():
while True:
url = q.get()
Spider.crawl_page(threading.currentThread().name, url)
q.task_done()
示例7: work
# 需要导入模块: from spider import Spider [as 别名]
# 或者: from spider.Spider import crawl_page [as 别名]
def work():
while True:
url = queue.get() # get url from queue.txt
Spider.crawl_page(threading.current_thread().name, url)
queue.task_done() # end task for worker. It can now find more jobs, if available