Created
October 15, 2015 03:53
-
-
Save cesarvargas00/9a3891cc9394c33b46e2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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