Created
October 4, 2015 15:27
-
-
Save jouderianjr/adaa8d32e21e23ed2678 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
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