I’m trying to do some web scrapping, I’m trying to get the link of some articles, but I can’t seem to hit the links. This is my code:
app.get('/test', (req, res) => {
var articles = []
axios.get("https://www.transfermarkt.com/rumour/rubrik/aktuell/18")
.then(response => {
const $ = cheerio.load(response.data)
$("div.newsticker__box").each( (i, element) => {
const link = $(element)
.find("a.newsticker__link")
.attr("href");
articles.push({
link
})
console.log(link)
})
})
res.json(articles)
})
When I try to just return response.data
I get just lots of symbols like this:
"u001f�bu0000u0000u0000u0000u0000u0000u0003�y�H�(��̧��{��u0014v��"!��U]H�u0002�#��c��Њu0016$���_Jl��ն���}�7�vu0019edfDFƖ�����G�7�߭&dW��u001c�Ihcc^I�F��?
What am I doing wrong here?