python直pyspider入门
1、WebUI 界面

2、入门demo,具体介绍见下图
from pyspider.libs.base_handler import *
class Handler(BaseHandler):
crawl_config = { }
@every(minutes=24 * 60)
def on_start(self):
self.crawl('http://scrapy.org/', callback=self.index_page)
@config(age=10 * 24 * 60 * 60)
def index_page(self, response):
for each in response.doc('a[href^="http"]').items():
self.crawl(each.attr.href, callback=self.detail_page)
def detail_page(self, response):
return {
"url": response.url,
"title": response.doc('title').text(),
}

3、开始运行
1.保存你的脚本
2.回到仪表板找到你的项目。
3.改变status为DEBUG。
4.点击run按钮。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:69
阅读量:152
阅读量:89
阅读量:26
阅读量:90