-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
30 lines (26 loc) · 794 Bytes
/
main.js
File metadata and controls
30 lines (26 loc) · 794 Bytes
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
const url = "https://github.com/topics";
const request = require('request');
const cheerio = require('cheerio');
const fs = require('fs');
const path = require('path');
const getRepoPageHtml = require("./reposPage");
request(url, cb);
function cb(err,response,html){
if(err){
console.log(err);
} else {
getTopicLinks(html);
}
}
function getTopicLinks(html){
let selTool= cheerio.load(html);
let topicArr = selTool(".topic-box a");
for (let i = 0; i < topicArr.length; i++) {
let link = selTool(topicArr[i]).attr("href");
let topicName = link.split("/")[2];
console.log(topicName);
console.log("```````````````````````````");
let fullLink = "https://github.com" + link;
getRepoPageHtml(fullLink,topicName);
}
}