我正在尝试使用链接提取器从页面中抓取一些URL,但我还需要知道针对其提取了响应URL的请求URL。
import scrapy
from scrapy.spider import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
class ExtractSpider(CrawlSpider):
name = 'Extract'
allowed_domains = ["xyz.com"]
start_urls = [a,b,c]
rules = [Rule(LinkExtractor(allow=('xyz.com/s')), callback="parse_link", follow=False)]
def parse_link(self, response):
yield {"start_Url": "I want to know"(a or b or c) ,"response_url":response.url}
我相信在这里我不能使用request.meta来传递变量。请指导。
答案 0 :(得分:1)
尝试一下:
type bar == [String, Number]