Add Rake task for importing covers from MobyGames #438
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This isn't quite perfect, but it works well enough that it's good to merge.
The problem is that the API doesn't expose a way to find a game by the URL fragment (e.g.
terraria
,half-life-2-episode-one
, etc.) so I have to search by the title of the game, which is pretty flaky ("The Legend of Zelda: Ocarina of Time" returns no games 🤔 ), and then use the URL fragment I have to match with the correct game, if it's returned by the API.Then it pulls down the cover image and attaches it to the game.
The API is pretty heavily rate limited, so we sleep for 10 seconds between every iteration in the loop. This helps make sure that we never get above 360 requests/hour. It'll take ~27 hours to get 10k games' covers.