Scrapy 如果我们在Scarpy中使用规则,谁是家长?
规则=( 规则(LinkExtractor)( restrict\u xpath='//需要\u数据', deny=deny_url),callback='parse_info'), 规则(LinkExtractor(allow=r'/need/',deny=deny_url),follow=True), )Scrapy 如果我们在Scarpy中使用规则,谁是家长?,scrapy,Scrapy,规则=( 规则(LinkExtractor)( restrict\u xpath='//需要\u数据', deny=deny_url),callback='parse_info'), 规则(LinkExtractor(allow=r'/need/',deny=deny_url),follow=True), ) 规则提取需要的URL进行刮取,对吗? 我可以在回调def中获取我们移动的URL吗? 例如。 网站-needdata.com 规则(LinkExtractor(allow=r'/need/'
规则
提取需要的URL进行刮取,对吗?我可以在回调
def
中获取我们移动的URL吗?例如。
网站-needdata.com
规则(LinkExtractor(allow=r'/need/',deny=deny_URL),follow=True),
提取像needdata.com/need/1这样的URL,对吗
Rule(LinkExtractor(
restrict_xpaths='//need_data',
deny=deny_urls), callback='parse_info'),
例如,从needdata.com/need/1提取URL时,它会显示一个包含人的表。然后
parse_info
将其删除。对吗?但我想在
parse_info
中了解谁是家长?如果needdata.com/need/1有needdata.com/people/1
我想添加到文件列
parent
,数据将是needdata.com/need/1怎么做?多谢各位 我们想使用
lx = LinkExtractor(allow=(r'shop-online/',))
然后
for l in lx.extract_links(response):
# l.url - it our url
然后使用
meta={'category': category}
我找不到更好的决定