mirror of
https://github.com/lyz05/danmaku.git
synced 2026-02-02 17:59:53 +08:00
feat: 添加订阅链接加速功能
This commit is contained in:
@@ -54,8 +54,14 @@ router.get('/', async function (req, res, next) {
|
|||||||
const subinfo = database.suburl[req.query.ctype]
|
const subinfo = database.suburl[req.query.ctype]
|
||||||
//返回指定订阅信息
|
//返回指定订阅信息
|
||||||
if (subinfo) {
|
if (subinfo) {
|
||||||
const ret = await oss.get('SUB/' + req.query.ctype)
|
const ua = req.headers['user-agent'];
|
||||||
res.type('text/plain').end(ret);
|
if (ua.indexOf('Mozilla') === -1) {
|
||||||
|
const url = await oss.signurl('SUB/' + req.query.ctype, true)
|
||||||
|
res.redirect(url)
|
||||||
|
} else {
|
||||||
|
const ret = await oss.get('SUB/' + req.query.ctype)
|
||||||
|
res.type('text/plain').end(ret);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
res.status(404).send('Not Found 找不到这种订阅类型');
|
res.status(404).send('Not Found 找不到这种订阅类型');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ function Iqiyi() {
|
|||||||
this.domain = 'iqiyi.com'
|
this.domain = 'iqiyi.com'
|
||||||
this.example_urls = [
|
this.example_urls = [
|
||||||
'https://www.iqiyi.com/v_19rr1lm35o.html', //api lens 11
|
'https://www.iqiyi.com/v_19rr1lm35o.html', //api lens 11
|
||||||
'https://www.iqiyi.com/v_1wozsa91cfs.html' //api lens 9
|
'https://www.iqiyi.com/v_1wozsa91cfs.html', //api lens 9
|
||||||
|
'https://www.iqiyi.com/v_1zzwhiozqww.html', //api lens 10
|
||||||
];
|
];
|
||||||
|
|
||||||
this.resolve = async (url) => {
|
this.resolve = async (url) => {
|
||||||
@@ -98,7 +99,7 @@ module.exports = Iqiyi
|
|||||||
if (!module.parent) {
|
if (!module.parent) {
|
||||||
const m = new Iqiyi();
|
const m = new Iqiyi();
|
||||||
|
|
||||||
m.work(m.example_urls[1]).then(() => {
|
m.work(m.example_urls[2]).then(() => {
|
||||||
// console.log(m.content);
|
// console.log(m.content);
|
||||||
console.log(m.title);
|
console.log(m.title);
|
||||||
memory();
|
memory();
|
||||||
|
|||||||
@@ -39,9 +39,12 @@ async function head(objname) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function signurl(objname) {
|
async function signurl(objname, isFast) {
|
||||||
try {
|
try {
|
||||||
const result = await client.signatureUrl(objname);
|
let result = await client.signatureUrl(objname);
|
||||||
|
if (isFast) {
|
||||||
|
result = result.replace("http://","//").replace(normalendpoint, fastendpoint)
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
@@ -54,5 +57,5 @@ if (!module.parent) {
|
|||||||
get('SUB/database.yaml');
|
get('SUB/database.yaml');
|
||||||
put('SUB/test.txt', '中文');
|
put('SUB/test.txt', '中文');
|
||||||
head('SUB/database.yaml');
|
head('SUB/database.yaml');
|
||||||
signurl('SUB/database.yaml');
|
signurl('SUB/database.yaml',true);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user