aspayr

Untitled

Nov 7th, 2020 (edited)
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. import scrapy
  2. from scrapy.spiders import SitemapSpider
  3. from parsel import Selector
  4.  
  5.  
  6. class DigikeySsylkiFromSitemapSpider(SitemapSpider):
  7.     name = 'digikey-ssylki-from-sitemap'
  8.     sitemap_urls = ['https://www.digikey.com/product-detail/sitemap.xml']
  9.     sitemap_rules = [('/submap/', 'parse')]
  10.     custom_settings = {
  11.         'CONCURRENT_REQUESTS': 64,
  12.         'DOWNLOAD_DELAY': 1
  13.     }
  14.  
  15.     def parse(self, response):
  16.         body = Selector(response.text)
  17.         body.xpath('//loc').get()
Add Comment
Please, Sign In to add comment