-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
63 lines (56 loc) · 1.81 KB
/
index.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
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
63
require("dotenv").config();
const puppeteer = require("puppeteer");
const MINUTE = 60 * 1000;
const sites = [
{ url: "http://localhost:3001", showFor: MINUTE * 10 },
{ url: "https://yle.fi/", showFor: MINUTE * 1 },
{ url: "http://localhost:3000", showFor: MINUTE * 10 },
{ url: "https://www.bouncingdvdlogo.com/", showFor: MINUTE * 1 },
{ url: "http://localhost:3000", showFor: MINUTE * 10 },
{ url: "http://v1.windows93.net/", showFor: MINUTE * 3 },
{ url: "http://localhost:3001", showFor: MINUTE * 10 },
{ url: "http://www.nyan.cat/", showFor: MINUTE * 3 },
{ url: "https://www.bouncingdvdlogo.com/", showFor: MINUTE * 5 },
{ url: "http://localhost:3001", showFor: MINUTE * 10 },
{ url: "https://cat-bounce.com/", showFor: MINUTE * 5 },
{ url: "http://www.patience-is-a-virtue.org/", showFor: MINUTE * 5 },
{ url: "http://localhost:3001", showFor: MINUTE * 10 },
{ url: "https://www.zoomquilt.org/", showFor: MINUTE * 5 },
];
function wait(time) {
return new Promise((resolve) => {
setTimeout(resolve, time);
});
}
async function main() {
const browser = await puppeteer.launch({
headless: false,
defaultViewport: null,
executablePath: process.env.CHROMIUM_EXECUTABLE,
userDataDir: "./data",
args: [
"--start-fullscreen",
"--kiosk",
"--disable-infobars",
"--disable-session-crashed-bubble",
"--noerrdialogs",
],
ignoreDefaultArgs: ["--enable-automation"],
});
const page = await browser.newPage();
page.setDefaultNavigationTimeout(0);
let i = 0;
while (true) {
const site = sites[i % sites.length];
console.log("Opening", site.url);
try {
await page.goto(site.url);
} catch (error) {
console.error("Failed to load", site.url);
console.error(error);
}
await wait(site.showFor);
i++;
}
}
main();