本文整理匯總了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