Skip to content

Instantly share code, notes, and snippets.

@cesarvargas00
Created October 15, 2015 03:53
Show Gist options
  • Select an option

  • Save cesarvargas00/9a3891cc9394c33b46e2 to your computer and use it in GitHub Desktop.

Select an option

Save cesarvargas00/9a3891cc9394c33b46e2 to your computer and use it in GitHub Desktop.
var request = require('request');
var fs = require('fs');
var array = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
var pegaOsAdjetivoCaraio = function(i, aToZ) {
if (i < aToZ.length) {
request('http://dicionarioadjetivo.blogspot.com/search/label/' + aToZ[i], function(error, response, body) {
if (!error && response.statusCode == 200) {
var x = body.match(/(title=".*">.+<\/a)/g);
for (var j = 0; j < x.length; j++) x[j] = x[j].slice(x[j].indexOf('>') + 1, x[j].indexOf('<'));
fs.appendFile('dicionarioAdjetivo.txt', x.join('\n'), function(err) {
if (err) throw err;
console.log('It\'s saved!');
i++;
console.log(i);
pegaOsAdjetivoCaraio(i, aToZ);
});
}
});
}
};
pegaOsAdjetivoCaraio(0, array);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment