Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scrapy
- class VianorSpider(scrapy.Spider):
- name = "vianor"
- allowed_domains = ['vianor-barnaul.ru']
- start_urls = [
- 'https://vianor-barnaul.ru/shiny/shiny-legkovye.html',
- ]
- def parse(self, response):
- check = ['2', '3', '4', '5', '6', '7', '8', '9', '10', '20', '30', '40', '50', '60', '70', '80', '90', '100', '200', '300']
- name = response.xpath('//*[contains(concat( " ", @class, " " ), concat( " ", "gtagclick", " " ))]/text()').getall()
- price = response.xpath('//*[contains(concat( " ", @class, " " ), concat( " ", "actual-price", " " ))]/text()').getall()
- link = response.xpath('//*[contains(concat( " ", @class, " " ), concat( " ", "gtagclick", " " ))]/@href').getall()
- yield {
- 'name': name,
- 'price': price,
- 'link': link,
- }
- for z in check:
- yield scrapy.FormRequest(url="https://vianor-barnaul.ru/assets/snippets/mycatalog/catalog.inc.php",
- formdata={'id_c': '9', 'pg': z, 'typshin': 'shiny-legkovye'},
- callback=self.parse)
Advertisement
Add Comment
Please, Sign In to add comment