Skip to content

Commit

Permalink
v0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
albert-marrero committed Mar 5, 2022
1 parent 22969f5 commit 08ac9e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions video_game_geek/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class GameItem(scrapy.Item):
output_processor=TakeFirst(),
)
rankings = scrapy.Field()
versions = scrapy.Field()
scraped_at = scrapy.Field(
serializer=float
)
Expand Down
11 changes: 11 additions & 0 deletions video_game_geek/spiders/games.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def build_game_requests(self, ids):
url = self.build_api_url(
path="xmlapi2/thing",
stats=1,
versions=1,
id=game_ids,
)
self.logger.info(f'API URL Created: {url}')
Expand Down Expand Up @@ -164,4 +165,14 @@ def parse_game(self, response):
}
loader.add_value('rankings', rankings)

for item in game.xpath('versions/item[@type = "videogameversion"]'):
versions = {
'release_date': item.xpath('releasedate/@value').get(),
'platform': item.xpath('link[@type = "videogameplatform"]/@value').get(),
'publisher': item.xpath('link[@type = "videogamepublisher"]/@value').get(),
'developer': item.xpath('link[@type = "videogamedeveloper"]/@value').get(),
'media': item.xpath('link[@type = "videogamemedia"]/@value').get(),
}
loader.add_value('versions', versions)

yield loader.load_item()

0 comments on commit 08ac9e6

Please sign in to comment.