My latest project is Steamy Screenshots (view source). It’s an app I made to extract colors from the screenshots people share on Steam. There’s no real usefulness to it, it was just a fun thing to do. You can look up a particular Steam user and view their newest fifty screenshots, or look at the newest screenshots shared for a particular game.
- Sinatra API that uses Mechanize to:
- Scrape a Steam user’s screenshots page and produce an RSS feed;
- Scrape a Steam game’s screenshots page and produce JSON;
- Scrape an individual Steam screenshot details page and produce JSON with details about the game.
- Steamy Screenshots’ own Sinatra API that:
- Provides a JSON endpoint for getting a list of friends for a given Steam user;
- Caches the giant list of all Steam apps (games, their DLC, etc.) and serves it up as JSON;
- Serves up a lunr.js index of the Steam apps as JSON;
- Provides an endpoint for getting an image hosted elsewhere via its URL, to get around CORS.
- Look up a Steam user by their name and see their latest screenshots;
- List a given user’s Steam friends so you can browse their screenshots;
- Search for a Steam game and see its latest screenshots that the community has shared;
- Get a palette of five colors for each screenshot.
I generate an RSS feed of a Steam user’s screenshots so I can consume that feed on If This Then That and have it post my screenshots to my Tumblr. That was the original impetus for the whole project: I wrote the web scraper Sinatra app so I could get an RSS feed of my own screenshots so they could auto-post to my Tumblr via IFTTT. Then I wanted to make something that built off of that RSS feed, and Steamy Screenshots was born.
To get the screenshots for a Steam game, I need to know its ID on Steam. To get that, I use lunr.js to let the user search the big JSON file of Steam apps that my app serves up. That’s what translates a user’s query of “oblivion” into a list of relevant Steam apps; when the user chooses the one titled “The Elder Scrolls IV: Oblivion”, I turn that into app ID 22330 and can then get the screenshots off of its Steam community page. I added a couple of scripts to my package.json for updating both the list of apps as well as the lunr.js index, using lunr-index-build for index generation.