Coder Social home page Coder Social logo

steamscraper's Introduction

##Intro

This script represents my first substantial work with Node.js beyond playing around with web application frameworks like Express. It would definitely need heavy refactoring to make the code more readable and re-usable.

##Background

One of the hobby projects I'm working on is related to video games and the digital distribution platform Steam. VALVe software provides an API for Steam, but there are certain data points for Steam products that weren't surfaced by their API.

For example, you can get a list of owned games from the API:

https://developer.valvesoftware.com/wiki/Steam_Web_API#GetOwnedGames_.28v0001.29

However, there is no official API for retrieving a list of the features a game supports. Luckily, VALVe's online store listings have a clean HTML structure that make it super-easy to reliably retrieve this information. Enter, my first web scraper.

##Description of script

I originally wrote this to experiment with Node.js modules such as request and cheerio. However, a few challenges quickly became apparent:

  • Simply looping over thousands of IDs and firing off HTTP requests was not a suitable solution due to open connection limits locally and remote throttling by my ISP or VAVLE's servers
  • Storing results on the filesystem is cumbersome and duplicating efforts on already-scraped data is slow
  • Asynchronous programming was definitely a model I was not used to (and admittedly I'm still learning)

I quickly realized I could use some help from the node module async and played around with the queue function in order to limit simultaneous requests. I then introduced Mongoose.js which I have used in other hobby projects and added an extra layer to the scraper to first check if a given APP ID had already been scraped.

There are still a few other odd artifacts from previous iterations hanging around and there are surely many neglected best practices.

##Requirements

  • MongoDB

##Directions

  • npm install
  • node steamScraper.js
  • Sit back and relax

steamscraper's People

Contributors

mattclaw avatar

Stargazers

Jir avatar Tom McGurl avatar

Watchers

 avatar

Forkers

jirwong

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.