-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (32 loc) · 1001 Bytes
/
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
require("dotenv").config();
const puppeteer = require("puppeteer");
const app = require("express")();
const credentials = {
token: process.env.ACCESS_TOKEN,
refresh: process.env.REFRESH_TOKEN,
};
(async () => {
const browser = await puppeteer.launch({
headless: false,
args: [
"--headless",
"--ignore-certificate-errors",
"--no-sandbox",
"--disable-setuid-sandbox",
],
});
const page = await browser.newPage();
await page.goto("https://dogehouse.tv");
await page.waitForSelector("button");
await page.evaluate(credentials => {
localStorage.setItem("@toum/token", credentials.token);
localStorage.setItem("@toum/refresh-token", credentials.refresh);
}, credentials);
await page.goto(process.env.ROOM_LINK);
app.get("/refresh", async (_, res) => {
await page.reload();
res.send("i refreshed");
});
})();
const port = process.env.PORT || 5678;
app.listen(port, "0.0.0.0", () => console.log("dude, I am LIVE! at " + port));