Pyspider 的用法请参见 pyspider 官网文档: http://docs.pyspider.org/
CROTON 修改版支持特性
[obj, obj, ...]支持迭代存储add/delete/hold/go/stop###一、operation api 说明
POST 操作/task/[add:delete:hold:go:start/stop]/[taskid]
######请求参数add 添加任务: {'script': #脚本内容}delete 删除任务: 无参数hold 暂停任务: 无参数go 继续任务: 无参数start 开始任务: 无参数stop 停止任务: 无参数{'result': 0 #success, 'desc': '', 'entity': #状态请求返回的字段}######task状态获取 api 说明
/task/[taskid]{'result': 0 #success, 'desc': '', 'entity': #状态信息字段}###二、一个project多schema存储支持;LIST类型[obj, obj, ...]迭代类型存储支
class Handler(BaseHandler):
@every(minutes=1)
def on_start(self):
self.crawl('http://edu.qq.com/l/abroad/studyabroad/lxbanli/qzbl/list20120530143633.htm', callback=self.index_page, last_modifed=False)
@config(age=30)
def index_page(self, response):
for each in response.doc('a[href^="http"]').items():
# 如果是对 LIST 里的对象迭代存储,请将 croton.schema:, 后的字段置空
# 将需要存储的字段传入 save 参数
# 'croton.schema:[identify], xxx' xxx 即为所需要自定义存储的schema
# identify 是一个可以表征这个数据obj唯一性的参数,例如:'croton.schema:8295843, test_table'
self.crawl('croton.schema:,oh_schema_XXX', callback=self.detail_page, save={'test': 'hhh'}, last_modifed=False)
@config(priority=2)
def detail_page(self, response, task):
return response.save
Content type
Image
Digest
sha256:a72f30db7…
Size
222.7 MB
Last updated
almost 11 years ago
docker pull jallyhe/pyspider