Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SimpleBookSpider(scrapy.Spider):
- name = "simplebooks"
- start_urls = [
- 'http://books.toscrape.com/catalogue/page-1.html',
- ]
- custom_settings = {
- 'LOG_LEVEL': logging.WARNING,
- 'ITEM_PIPELINES': {'__main__.JsonWriterPipeline': 1},
- 'FILE_NAME': "quotes.jl"
- }
- def parse(self, response):
- results = response.css('div.product_pod')
- for quote in results:
- yield{
- 'title': product_pod.css('h3 a::attr(tittle)').extract_first(),
- 'price': product_pod.css('div.product_price p.price_color::text').extract_first(),
- }
Add Comment
Please, Sign In to add comment