0
i’m having trouble implementing a code. I’ve been helped at another time and now I’m needing it again.
The goal is a script that helps me to remove from an html the name of teachers and the link of their respective lattes, save in some way for later I treat the data.
I am a beginner in this world and still do not know how to work with jquery, but nothing prevents me from using this option if I am guided.
Analyzing the html code of the page, I could notice that the html tag <h2>
is only used for the names of teachers, so I took the contents of all headers2 and managed to save. I realized that after this tag, the next "href" is where the link lattes of the respective teacher is... I’m stuck at exactly this point.
I’ve said a lot, but I think I’ve made myself clear.
Thank you guys.
const url = 'http://www.ppg-educacao.uff.br/novo/index.php/corpo-docente'
const axios = require('axios')
const cheerio = require('cheerio')
axios.get(url).then(response =>{
const funcionarios = response.data
const $ = cheerio.load(response.data)
const professores = $('h2').text()
console.log($('h2').text())
//const lattes = $('a href="http://lattes.cnpq.br/"' ).text()
//console.log(lattes)
//const informacoes = []
//informacoes.push({'nome ': professores, 'lattes ': lattes})
//console.log (informacoes)
})