Skip to content

Instantly share code, notes, and snippets.

@ngryman
Created June 27, 2014 22:12
Show Gist options
  • Select an option

  • Save ngryman/1f814e01bfaf66245f11 to your computer and use it in GitHub Desktop.

Select an option

Save ngryman/1f814e01bfaf66245f11 to your computer and use it in GitHub Desktop.
Scrapper for Jerem
{
"name": "grabber",
"version": "0.0.0",
"description": "Jeremy se lance dans le bis",
"main": "grabber.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"async": "^0.9.0",
"jsdom": "^0.11.0"
}
}
/**
* Dependencies.
*/
var jsdom = require('jsdom');
var async = require('async');
/**
* Selectors.
*/
const JOB_LINK = '.job-item .job-title .job-link';
/**
* Entry point.
*/
goTo('https://remixjobs.com', function(err, window) {
var $ = window.jQuery;
var jobReqs = [];
$(JOB_LINK).each(function() {
jobReqs.push(
goTo.bind(this, this.href)
);
});
async.parallel(jobReqs, function(err, results) {
var window = results[0];
var tags = {};
for (var result in results) {
var window = results[result];
var $ = window.jQuery;
$('.tags-occupation .tag').each(function() {
tags[this.textContent] = tags[this.textContent] || 0;
tags[this.textContent]++;
});
}
for (var tag in tags)
console.log($.trim(tag), tags[tag]);
})
});
/**
* Misc.
*/
function goTo(url, done) {
jsdom.env({
url: url,
scripts: ['http://code.jquery.com/jquery.js'],
done: done
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment