-
Notifications
You must be signed in to change notification settings - Fork 1
/
sitemap.js
37 lines (36 loc) · 1.08 KB
/
sitemap.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
35
36
37
// Check https://www.vuemastery.com/sitemap.xml For New Items
const https = require('https');
async function getSitemapUrls(){
return new Promise(function(resolve, reject) {
https.get(`https://www.vuemastery.com/sitemap.xml`, res => {
res.setEncoding("utf8");
let body = "";
res.on("data", data => {
body += data;
});
res.on("end", () => {
const regex = /www.vuemastery.com\/courses\/(.*?)</giu;
let m;
let out = [];
while ((m = regex.exec(body)) !== null) {
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
m.forEach((match) => {
if(match.indexOf('<') < 0)
out.push(`https://www.vuemastery.com/courses/` + match);
});
}
resolve(out);
});
res.on('error', (e) => {
reject(e)
});
});
})
}
async function GetLinks(){
let data = await getSitemapUrls();
console.log(data);
}
GetLinks();