-
Notifications
You must be signed in to change notification settings - Fork 7
/
server.js
55 lines (46 loc) · 1.03 KB
/
server.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
const express = require("express");
const app = express();
const bodyParser = require('body-parser');
app.use(bodyParser.json());
const KPSDK_SOLVER = require('./src/index.js');
async function solve(pjs, path) {
const {
close,
fetch,
KPSDK_message
} = await KPSDK_SOLVER({
kasada: {
configuration: [{
domain: 'kick.com',
method: 'POST',
path: path,
}
],
sdk_script_url: pjs,
},
parent_url: 'https://kick.com'
});
console.log(KPSDK_message);
const {
route,
request
} = await fetch(`https://kick.com${path}`, {
method: 'POST'
});
let res = request.headers();
await route.continue();
await close();
return {
"user-agent": res["user-agent"],
"x-kpsdk-ct": res["x-kpsdk-ct"],
"x-kpsdk-cd": res["x-kpsdk-cd"]
}
}
app.post("/solve", (req, res) => {
solve(req.body.pjs, req.body.path).then((response) => {
res.json(response)
})
})
app.listen(3033, () => {
console.log("Server started")
})