-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepoPage.js
34 lines (31 loc) · 1.06 KB
/
repoPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const request = require("request");
const cheerio = require("cheerio");
const getIssuesPageHtml = require("./issue");
function getRepoPageHtml(url,topic) {
request(url, cb);
function cb(err, response, html) {
if (err) {
console.log(err);
} else if(response.statusCode == 404) {
console.log("Page not Found");
} else {
getRepoLink(html)
// console.log(html);
}
}
function getRepoLink(html){
let $ = cheerio.load(html);
let headingArr = $(".f3.color-fg-muted.text-normal.lh-condensed");
console.log(topic);
for (let i = 0; i < 8; i++){
let twoAnchors = $(headingArr[i]).find("a");
let link = $(twoAnchors[1]).attr("href");
// console.log(link);
let fullLink = `https://github.com${link}/issues`;
let repoName = link.split("/").pop();
getIssuesPageHtml(fullLink, topic, repoName);
}
console.log("``````````````````````````")
}
}
module.exports = getRepoPageHtml;