【发布时间】:2016-12-16 08:21:37
【问题描述】:
我正在写一个蜘蛛来报废网站:
第一个 url www.parenturl.com 调用 parse 函数,从那里我提取了 url www.childurl.com,我有一个回调到 parse2 函数并返回 dict。
问题 1)我需要将 dict 值与我在解析函数中从父 url 中提取的其他 7 个值一起存储在 mysql 数据库中吗? (response_url 不打印)
def parse(self, response):
for i in range(0,2):
url = response.xpath('//*[@id="response"]').extract()
response_url=yield SplashFormRequest(url,method='GET',callback=self.parse2)
print response_url # prints None
def parse2(self, response):
dict = {'url': response.url}
return dict
【问题讨论】:
标签: python web scrapy scrapy-spider scrapy-splash