Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scrapy
- from scrapy_splash import SplashRequest
- class SplashSpider(scrapy.Spider):
- name = 'splash_spider'
- start_urls = ['https://angular.io/docs']
- def start_requests(self):
- # Generate SplashRequests to the specified start URLs with a 2-second delay.
- for url in self.start_urls:
- yield SplashRequest(url, self.parse, args={'wait': 2})
- def parse(self, response):
- # Extract the title from the response HTML using a CSS selector.
- title = response.css('title::text').get()
- yield {'title': title}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement