Skip to content

Instantly share code, notes, and snippets.

@zgohr
Created December 3, 2011 20:56
Show Gist options
  • Save zgohr/1428134 to your computer and use it in GitHub Desktop.
Save zgohr/1428134 to your computer and use it in GitHub Desktop.
Mining web page content from the command line via node
# traditional method of searching a website for content
# curl contents of a web page, piped to grep to match regex
$ curl "foo.com" -Ls | grep -o bar
# proof of concept, piping to allow node.io to do the matching.
# node.io has a builtin eval method that uses javascript's eval
# to handle the matching
$ curl "foo.com" -Ls | node.io -s eval "input.match(/bar/g)"
# install node.io globally with npm
$ npm install -g node.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment