【发布时间】:2016-05-13 07:10:28
【问题描述】:
我正在使用带有 splash 的 scrapy,在我的 splash 中我可以发送多个值,但在我的 scrapy 代码中我无法处理所有内容。例如, 这是我的启动脚本
splash_script = """
function main(splash)
local url = splash.args.url
return {
html = splash:html(),
number = 1
}
end
"""
从scrapy触发splash的方法
yield scrapy.Request(
url= response.urljoin(url),
callback = self.product_details,
errback=self.error,
dont_filter=True,
meta = {
'splash':{
'endpoint': 'render.html',
'cache_args': ['lua_source'],
'args' :{
'index': index,
'http_method':'GET',
'lua_source': self.splash_script,
}
}
},
)
回调方法
def product_details(self,response):
print response.body
这个方法只接收html内容,我看不到数字
【问题讨论】:
标签: scrapy scrapy-spider splash-screen