如题,最近我想通过Vue发起ajax调用来操作Scrapy
项目,但是我的表达能力太差了,没有搜到什么东西,具体我想这样
axios.post({
url: 'url where the scrapy deployed',
params: 'name of scrapy spider'
}).then((response) => {
console.log(response)
})
还请各位指点
如题,最近我想通过Vue发起ajax调用来操作Scrapy
项目,但是我的表达能力太差了,没有搜到什么东西,具体我想这样
axios.post({
url: 'url where the scrapy deployed',
params: 'name of scrapy spider'
}).then((response) => {
console.log(response)
})
还请各位指点
这个和vue没有关系, axios是一个封装好的ajax库 你可以看一下axios的API
axios.post({
url: 'url where the scrapy deployed', // 这里是你爬取的目标地址
params: 'name of scrapy spider' // 这里是请求参数
}).then((response) => {
console.log(response) // 成功后 返回的结果,在这里你可以储存到你想保存的地方
})
如果对js不很熟悉的话,你可以试试你比较擅长的语言
但是你怎么部署Scrapy
爬虫服务,让他能像Web服务器一样能被请求呢??
爬虫应该是在后台通过定时器自动执行的吧,不需要像web服务器一样被请求,爬取结果保存在指定位置,web服务器看下结果就可以了