scrapy get text custom tags 1

scrapy get text custom tags

# Html example: 10/06/2020 16h56

getData = response.xpath("//span[@property='rnews:datePublished']/text()").get()

# Output: '10/06/2020 16h56'

Here is what the above code is Doing:
1. We are using the response object to find the xpath of the datePublished property.
2. We are using the get() method to extract the text from the xpath.
3. We are printing the output.

Similar Posts