Created
December 3, 2011 20:56
-
-
Save zgohr/1428134 to your computer and use it in GitHub Desktop.
Mining web page content from the command line via node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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