main.py 文件源码

python
阅读 15 收藏 0 点赞 0 评论 0

项目:Sneaker-Notify 作者: YuLin12345 项目源码 文件源码
def parse(self, response):
        while True:
            try:
                products = Selector(response).xpath('//div[@class="grid-uniform grid--center wide--grid--middle"]//div[contains(@class,"grid__item")]')

                for product in products:
                    item = KithItem()
                    item['name'] = product.xpath('div/div/a[1]/img/@alt').extract()[0]
                    item['link'] = "https://kith.com" + product.xpath('div/div/a[1]/@href').extract()[0]
                    # item['image'] = "https:" + product.xpath('div/div/a[1]/img/@src').extract()[0]
                    item['size'] = "https://kith.com/cart/add.js?id=" + product.xpath('div/div/a[2]/div/*/div[1]/@data-value').extract()[0] + "&quantity=1"
                    yield item

                yield Request(KithURL, callback=self.parse, dont_filter=True, priority=0)   

            except:
                pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号