Guest User

Untitled

a guest
Dec 21st, 2020
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. def parse(self, response):
  2. prices_item = ScgPriceItem()
  3. selector = Selector(text=response.text)
  4. prices = selector.xpath('//div[@class="hawk-results-item__options-table-cell hawk-results-item__options-table-cell--price childAttributes"]/text()').getall()
  5. valid_prices = [float(price[1::]) for price in prices]
  6. prices_item['max_price'] = max(valid_prices)
  7. prices_item['min_price'] = min(valid_prices)
  8. print(prices_item)
  9. return prices_item
  10.  
  11. =======bot.py==========
  12.  
  13. runner = CrawlerRunner(get_project_settings())
  14. d = runner.crawl('starcitygames', domain='starcitygames.com', myurls=[card_search])
  15. d.addBoth(lambda _: reactor.stop())
  16. reactor.run()
Advertisement
Add Comment
Please, Sign In to add comment