web scraping - Scrapy: extracting data from an html tag that uses an "id" Selector instead of a "class" -


i new web scraping , scrapy. hope can me.

i trying extract data web page uses tag. usually, if span tag using class, example:

<span class="class_a>hello, world!</span> 

i use following code retrieve text.

request.css('span.class_a::text').extract() 

however, when html using "id" instead of "class", example,

<span id="id_a>hello, universe!</span> 

the code below not work anymore.

request.css('span.id_a::text').extract() 

please help! what's correct way of extracting data using "id".

thank help!

the problem you're using "class selector" (please check this reference). should use "id selector", should work:

response.css('#id_a::text').extract() 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -