Skip to content

Instantly share code, notes, and snippets.

@niceaji
Created May 15, 2013 06:12
Show Gist options
  • Save niceaji/5581954 to your computer and use it in GitHub Desktop.
Save niceaji/5581954 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
/**
npm install cheerio request step
chmod +x urlparser.js
./urlparser.js
*/
var cheerio = require('cheerio')
, request = require('request')
, Step = require('step')
Step(
function readUrl(){
request("http://daum.net", this);
},
function allImgUrl(err, data){
if (err) throw err;
var html = data.body
, $ = cheerio.load(html)
$('img').each(function(index, el){
console.log( $(el).attr('src') );
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment