Advertisement
dereksir

Untitled

Aug 16th, 2023
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. import scrapy
  2.  
  3. class PlaywrightSpider(scrapy.Spider):
  4.     name = 'playwright_spider'
  5.     start_urls = ['https://angular.io/docs']
  6.  
  7.     def start_requests(self):
  8.         for url in self.start_urls:
  9.             # Set the playwright Request.meta key
  10.             yield scrapy.Request(url, meta={"playwright": True})
  11.  
  12.     def parse(self, response):
  13.         # Extract the page title
  14.         title = response.css('title::text').get()
  15.         yield {'title': title}
  16.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement