Spider-crawler / scraper.py
ositamiles's picture
Update scraper.py
3745891 verified
raw
history blame contribute delete
780 Bytes
import scrapy
class IGDBSpider(scrapy.Spider):
name = 'igdb_spider'
start_urls = ['https://www.igdb.com/games/recently_released']
def parse(self, response):
for game in response.css('div.game_display'):
yield {
'title': game.css('h3.name a::text').get(),
'release_date': game.css('div.release_date span::text').get(),
'genre': game.css('div.genres span::text').get(),
'platform': game.css('div.platforms a::text').get(),
'rating': game.css('div.rating span::text').get()
}
# Pagination (if available)
next_page = response.css('a.next_page::attr(href)').get()
if next_page:
yield response.follow(next_page, self.parse)