>>> response.xpath(‘//base/@href‘).extract()
>>> response.css(‘base::attr(href)‘).extract()
>>> response.xpath(‘//a[contains(@href, "image")]/@href‘).extract()
>>> response.css(‘a[href*=image]::attr(href)‘).extract()
>>> response.xpath(‘//a[contains(@href, "image")]/img/@src‘).extract()
>>> response.css(‘a[href*=image] img::attr(src)‘).extract()
>>> response.xpath(‘//a[contains(@href, "image")]/text()‘).re(r‘Name:\s*(.*)‘)
>>> sel.xpath(‘//li[re:test(@class, "item-\d$")]//@href‘).extract()
时间: 2024-08-02 11:57:41