Answer the question
In order to leave comments, you need to log in
How to get the names of repositories on github using cheeriojs?
I need to get a link to a repository from the href attribute in the repository name.
I'm parsing repositories from the link https://github.com/search?q=vuejs
Here is my code:
const rp = require('request-promise');
const $ = require('cheerio');
const url = 'https://github.com/search?q=vuejs';
rp(url)
.then(function (html) {
//success!
const vueUrls = [];
for (let i = 0; i < 50; i++) {
vueUrls.push($('.repo-list a', html)[i].attribs.href);
}
console.log(vueUrls);
})
.catch(function (err) {
//handle error
});
Answer the question
In order to leave comments, you need to log in
If I understand correctly what element we are talking about, then you should change the selector to ".repo-list av-align-middle"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question