blob: b3da21cc5c0fd120195642908154541687005e9d (
plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
This file is only ran by GitHub Actions in order to populate the Invidious instances list
This file should not be shipped with the extension
*/
/*
Criteria for inclusion:
Invidious
- uptime >= 80%
- must have been up for at least 90 days
- HTTPS only
- url includes name (this is to avoid redirects)
Piped
- 30d uptime >= 90%
- available for at least 80/90 days
- must have been up for at least 90 days
- must not be a wildcard redirect to piped.video
- must be currently up
- must have a functioning frontend
- must have a functioning API
*/
import { writeFile, existsSync } from "fs"
import { join } from "path"
import { getInvidiousList } from "./invidiousCI";
// import { getPipedList } from "./pipedCI";
const checkPath = (path: string) => existsSync(path);
const fixArray = (arr: string[]) => [...new Set(arr)].sort()
async function generateList() {
// import file from https://api.invidious.io/instances.json
const invidiousPath = join(__dirname, "invidious_instances.json");
// import file from https://github.com/TeamPiped/piped-uptime/raw/master/history/summary.json
const pipedPath = join(__dirname, "piped_instances.json");
// check if files exist
if (!checkPath(invidiousPath) || !checkPath(pipedPath)) {
console.log("Missing files")
process.exit(1);
}
// static non-invidious instances
const staticInstances = ["www.youtubekids.com"];
// invidious instances
const invidiousList = fixArray(getInvidiousList())
// piped instnaces
// const pipedList = fixArray(await getPipedList())
console.log([...staticInstances, ...invidiousList])
writeFile(
join(__dirname, "./invidiouslist.json"),
JSON.stringify([...staticInstances, ...invidiousList]),
(err) => {
if (err) return console.log(err);
}
);
}
generateList()
|