Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scrapy
- class AstroSpider(scrapy.Spider):
- name = "Astro"
- allowed_domains = ['www.astrolighting.com']
- start_urls = ['https://www.astrolighting.com/products']
- def parse(self, response, **kwargs):
- for link in response.css('article.product-listing-item a::attr(href)'):
- #print(link)
- yield response.follow(link.get(), callback=self.parse_items)
- def parse_items(self, response):
- for link in response.css('div.variants.variants--large a::attr(href)'):
- print(link.get())
- yield response.follow(link.get(), callback=self.parse_item)
- def parse_item(self, response):
- print(f"!!!!!!!!!!!!!!!!!!!!!!!!!!!")
- yield {
- 'name': response.css('div.detail__right h1::text').get(),
- 'material': response.css('div.detail__right p span::text').getall()[0],
- 'id': response.css('div.detail__right p span::text').getall()[1].strip()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement