I am using scrapy to crawl. I am getting whole content of website.
import scrapy
import os
class QuotesSpider(scrapy.Spider):
name = "team"
def start_requests(self):
yield scrapy.Request(url='http://*****.com', callback=self.get_scripts)
def get_scripts(self, response):
print response.css("body").extract()
def get_scripts(self, response):
print response.css("body").extract()
Now i am searching for a text, which i can get by simple search text/sub-string by python. What i want is to select that selector where this text match. Please let know what is the best way to do this.
You can do something like this.
response.xpath("//*[contains(text(), 'MY TEXT')]").getall()
It will return list of all items containing MY TEXT
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With