Guest User

Untitled

a guest
Jan 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. class SimpleBookSpider(scrapy.Spider):
  2. name = "simplebooks"
  3. start_urls = [
  4. 'http://books.toscrape.com/catalogue/page-1.html',
  5. ]
  6. custom_settings = {
  7. 'LOG_LEVEL': logging.WARNING,
  8. 'ITEM_PIPELINES': {'__main__.JsonWriterPipeline': 1},
  9. 'FILE_NAME': "quotes.jl"
  10. }
  11.  
  12. def parse(self, response):
  13. results = response.css('div.product_pod')
  14. for quote in results:
  15. yield{
  16. 'title': product_pod.css('h3 a::attr(tittle)').extract_first(),
  17. 'price': product_pod.css('div.product_price p.price_color::text').extract_first(),
  18. }
Add Comment
Please, Sign In to add comment