Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def parse(self, response):
- prices_item = ScgPriceItem()
- selector = Selector(text=response.text)
- prices = selector.xpath('//div[@class="hawk-results-item__options-table-cell hawk-results-item__options-table-cell--price childAttributes"]/text()').getall()
- valid_prices = [float(price[1::]) for price in prices]
- prices_item['max_price'] = max(valid_prices)
- prices_item['min_price'] = min(valid_prices)
- print(prices_item)
- return prices_item
- =======bot.py==========
- runner = CrawlerRunner(get_project_settings())
- d = runner.crawl('starcitygames', domain='starcitygames.com', myurls=[card_search])
- d.addBoth(lambda _: reactor.stop())
- reactor.run()
Advertisement
Add Comment
Please, Sign In to add comment