Created
September 12, 2013 03:26
-
-
Save onel0p3z/6532762 to your computer and use it in GitHub Desktop.
First draft of a scrapper for cfm's WMBD webApp To run, download both files, run 'npm install', and then 'node app.js'
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
var $ = require('cheerio'), | |
_ = require('lodash'), | |
request = require('request'); | |
var url = 'http://www.themiamibikescene.com/search/label/stolen%20bike'; | |
request(url, function(err, resp, html){ | |
if(err){ | |
return console.log(err); | |
}; | |
var parsed = $.load(html); | |
parsed('.post-outer').children().children().map(function(i,el) { | |
var id = $(el).attr('id'); | |
if(!_.isUndefined(id)){ | |
var text = $(el).text().trim(); | |
console.log('\ni:'+ i + '\nid: ' + id + '\ntext:' + text +'\n'); | |
}; | |
}); | |
}); |
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
{ | |
"name": "cfm_wmbd_dataScrapper", | |
"version": "0.0.0", | |
"description": "First draft of a scrapper for cfm's WMBD webApp", | |
"main": "app.js", | |
"dependencies": { | |
"cheerio": "*", | |
"request": "*", | |
"lodash": "*" | |
}, | |
"scripts": { | |
"test": "null" | |
}, | |
"repository": "", | |
"author": "Juan Lopez", | |
"license": "MIT" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment