Skip to content

Instantly share code, notes, and snippets.

@onel0p3z
Created September 12, 2013 03:26
Show Gist options
  • Save onel0p3z/6532762 to your computer and use it in GitHub Desktop.
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'
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');
};
});
});
{
"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