Advertisement
vlpap

quotes_spider_pt2.py

Feb 25th, 2021
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. import scrapy
  2.  
  3. class QuotesSpider(scrapy.Spider):
  4.     name = "quotes_pt2"
  5.    
  6.     start_urls = ['http://quotes.toscrape.com/page/1/',
  7.                   'http://quotes.toscrape.com/page/2/',
  8.     ]
  9.            
  10.     def parse(self, response):
  11.         for quote in response.css('div.quote'):
  12.             yield {
  13.                 'text' : quote.css('span.text::text').get(),
  14.                 'author' : quote.css('small.author::text').get(),
  15.                 'tags' : quote.css('div.tags a.tag::text').getall(),
  16.             }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement