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

Viewed 14877

I am new to web scraping and Scrapy. I hope you can help me.

I am trying to extract data from a web page where it uses tag. Usually, if the span tag is using a class, for example:

<span class="class_A>Hello, World!</span>

I would use the following code to retrieve the text.

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

However, when an html is now using an "id" instead of a "class", for example,

<span id="id_A>Hello, Universe!</span>

the code below does not work anymore.

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

Please help! What's the correct way of extracting data using an "id".

Thank you for your help!

2 Answers
Related