The element you're targeting might be dynamically rendered. I tried this and got it to work, I'm targeting the price lower down on the page instead.
import scrapy
class TestSpider(scrapy.Spider):
name = 'testspider'
def start_requests(self):
return [scrapy.Request(
url='https://cutt.ly/bjj3ohW',
)]
def parse(self, response):
price = response.css('.price-final > strong::text').get()
print(price)
A good way to test if it's dynamically rendered is to open inspect panel in Chrome (F12)
and look under the Network tab. Reload the page and look and the first response which should be a .html
file. Click on that file and then Response. There you can see the html code you can parse in Scrapy. Click ctrl+F
and search for the CSS selector you're trying to parse.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…