Skip to content

Instantly share code, notes, and snippets.

@jouderianjr
Created October 4, 2015 15:27
Show Gist options
  • Save jouderianjr/adaa8d32e21e23ed2678 to your computer and use it in GitHub Desktop.
Save jouderianjr/adaa8d32e21e23ed2678 to your computer and use it in GitHub Desktop.
console.log('yannper');
var request = require('request'),
cheerio = require('cheerio'),
baseUrl = 'http://www.teses.usp.br/teses/disponiveis/';
request(baseUrl, function (error, reponse, body) {
$ = cheerio.load(body);
var links = $('td').children().filter('a');
console.log(links.length);
// console.log(links);
// console.log(typeof links);
$(links).each(function (i, link) {
var href = $(link).attr('href');
//To Pegando o link 2 só pra testar
if(i == 2){
request(baseUrl+href, function (error, response, body) {
$2 = cheerio.load(body);
var linksN2 = $2('td').children().filter('a');
console.log('aqui eu estou dentro do nivel 2, é bom tu organizar isso aqui hhaah só testei rpa te mostrar como funciona')
});
}
})
})
console.log('fim yannper');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment