Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scrapy
- from scrapy.spiders import CrawlSpider, Rule
- from scrapy.linkextractors import LinkExtractor
- class VianorcspdrSpider(CrawlSpider):
- name = 'vianorcspdr'
- allowed_domains = ['vianor-barnaul.ru']
- start_urls = ['https://vianor-barnaul.ru/shiny/hankook/6742/tovar-Ц0000136558.html']
- rules = (
- Rule(LinkExtractor(allow=('shiny',)), follow=True),
- Rule(LinkExtractor(allow=('tovar',)), callback='parse'),
- )
- def parse(self, response):
- name = response.xpath('//*[@id="content_main"]/h1/text()').extract()
- price = response.xpath('//*[@id="catalog"]/div/div[2]/p[2]/span/@rel').extract()
- link = response.url
- yield {
- 'name': name,
- 'price': price,
- 'link': link,
- }
Add Comment
Please, Sign In to add comment