-
Notifications
You must be signed in to change notification settings - Fork 10
/
app.js
83 lines (80 loc) · 2.59 KB
/
app.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
const express = require('express');
const app = express();
app.disable("x-powered-by");
const config = require('./Config/config')
const net = require('./Config/net');
//app.set('trust proxy',true)
app.get('/intl/gateway/v2/ogv/view/app/season', net.ip, net.auth, async (req, res, next) => {
data = await net.th_season(req.query)
res.set({
'Access-Control-Allow-Origin': 'https://www.bilibili.com',
'Access-Control-Allow-Credentials': 'true'
})
res.send(data)
});
app.get('/pgc/player/api/playurl', net.ip, net.auth, async (req, res, next) => {
data = await net.playurl(req.query)
res.set({
'Access-Control-Allow-Origin': 'https://www.bilibili.com',
'Access-Control-Allow-Credentials': 'true'
})
res.send(data)
});
app.get('/intl/gateway/v2/ogv/playurl', net.ip, net.auth, async (req, res, next) => {
data = await net.th_playurl(req.query)
res.set({
'Access-Control-Allow-Origin': 'https://www.bilibili.com',
'Access-Control-Allow-Credentials': 'true'
})
res.send(data)
});
app.get('/intl/gateway/v2/app/subtitle', net.ip, async (req, res, next) => {
data = await net.th_subtitle(req.query)
res.set({
'Access-Control-Allow-Origin': 'https://www.bilibili.com',
'Access-Control-Allow-Credentials': 'true'
})
res.send(data)
});
app.get('/x/v2/search/type', net.ip, net.auth, async (req, res, next) => {
data = await net.app_search(req.query)
res.set({
'Access-Control-Allow-Origin': 'https://www.bilibili.com',
'Access-Control-Allow-Credentials': 'true'
})
res.send(data)
});
app.get('/x/web-interface/search/type', net.ip, net.auth, async (req, res, next) => {
data = await net.web_search(req.query)
res.set({
'Access-Control-Allow-Origin': 'https://www.bilibili.com',
'Access-Control-Allow-Credentials': 'true'
})
res.send(data)
});
app.get('/intl/gateway/v2/app/search/type', net.ip, net.auth, async (req, res, next) => {
data = await net.th_search(req.query)
res.set({
'Access-Control-Allow-Origin': 'https://www.bilibili.com',
'Access-Control-Allow-Credentials': 'true'
})
res.send(data)
});
app.get('/pgc/player/web/playurl', net.ip, net.auth, async (req, res, next) => {
data = await net.web_playurl(req.query)
res.set({
'Access-Control-Allow-Origin': 'https://www.bilibili.com',
'Access-Control-Allow-Credentials': 'true'
})
res.send(data)
});
app.use(function (req, res) {
res.status(404).json({
"code": -400,
"message": "请求错误,没有此接口"
})
})
const server = app.listen(config.port, () => {
let port = server.address().port;
console.log(`服务已启动,端口为: ${port}`);
});