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]
|
||||
//返回指定订阅信息
|
||||
if (subinfo) {
|
||||
const ret = await oss.get('SUB/' + req.query.ctype)
|
||||
res.type('text/plain').end(ret);
|
||||
const ua = req.headers['user-agent'];
|
||||
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 {
|
||||
res.status(404).send('Not Found 找不到这种订阅类型');
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ function Iqiyi() {
|
||||
this.domain = 'iqiyi.com'
|
||||
this.example_urls = [
|
||||
'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) => {
|
||||
@@ -98,7 +99,7 @@ module.exports = Iqiyi
|
||||
if (!module.parent) {
|
||||
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.title);
|
||||
memory();
|
||||
|
||||
@@ -39,9 +39,12 @@ async function head(objname) {
|
||||
}
|
||||
}
|
||||
|
||||
async function signurl(objname) {
|
||||
async function signurl(objname, isFast) {
|
||||
try {
|
||||
const result = await client.signatureUrl(objname);
|
||||
let result = await client.signatureUrl(objname);
|
||||
if (isFast) {
|
||||
result = result.replace("http://","//").replace(normalendpoint, fastendpoint)
|
||||
}
|
||||
return result
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@@ -54,5 +57,5 @@ if (!module.parent) {
|
||||
get('SUB/database.yaml');
|
||||
put('SUB/test.txt', '中文');
|
||||
head('SUB/database.yaml');
|
||||
signurl('SUB/database.yaml');
|
||||
signurl('SUB/database.yaml',true);
|
||||
}
|
||||
Reference in New Issue
Block a user