Skip to content

Commit b65d27a

Browse files
committed
弹幕分片下载请求已加入重试机制,重试次数为1次
1 parent 9f7b633 commit b65d27a

File tree

11 files changed

+240
-152
lines changed

11 files changed

+240
-152
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ LogVar 弹幕 API 服务器
266266
> cf部署可能不稳定,推荐用vercel/netlify部署。
267267

268268
## API食用指南
269-
支持 forward/senplayer/hills/小幻/yamby/eplayerx/afusekt/uz影视/dscloud 等支持弹幕API的播放器。
269+
支持 forward/senplayer/hills/小幻/yamby/eplayerx/afusekt/uz影视/dscloud/lenna 等支持弹幕API的播放器。
270270

271271
以`senplayer`为例:
272272
1. 获取到部署之后的API地址,如 `http://192.168.1.7:9321/87654321` ,其中`87654321`是默认token(默认为87654321的情况下也可以不带token),如果有自定义环境变量TOKEN,请替换成相应的token
@@ -490,6 +490,7 @@ danmu_api/
490490
- /api/v2/comment接口默认限流:1分钟内同一IP只能请求3次,可通过环境变量`RATE_LIMIT_MAX_REQUESTS`调整(设置为0表示不限流)。
491491
- TMDB源请求逻辑:search tmdb -> tmdbId -> imdbId -> doubanId -> playUrl;优点:emby通过tmdb刮削,标题通过tmdb搜索,返回的信息可能更加匹配;缺点:链条过长,请求时长5-10s左右,中间一环数据有缺失,就没有返回结果。
492492
- TMDB源在SOURCE_ORDER添加tmdb的同时,需要添加TMDB_API_KEY环境变量
493+
- 弹幕分片下载请求已加入重试机制,重试次数为1次
493494
494495
### 关联项目
495496
[喂饭教程1:danmu_api vercel 自动同步部署方案 - 永远保持最新版本!实时同步原作者更新](https://github.com/xiaoyao20084321/log-var-danmu-deployment-guide)

danmu_api/configs/globals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const Globals = {
1111
accessedEnvVars: {},
1212

1313
// 静态常量
14-
VERSION: '1.7.3',
14+
VERSION: '1.7.4',
1515
MAX_LOGS: 500, // 日志存储,最多保存 500 行
1616
MAX_ANIMES: 100,
1717

danmu_api/sources/bahamut.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ export default class BahamutSource extends BaseSource {
360360
"Content-Type": "application/json",
361361
"User-Agent": "Anime/2.29.2 (7N5749MM3F.tw.com.gamer.anime; build:972; iOS 26.0.0) Alamofire/5.6.4",
362362
},
363+
retries: 1,
363364
});
364365

365366
// 将当前请求的 episodes 拼接到总数组

danmu_api/sources/bilibili.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ export default class BilibiliSource extends BaseSource {
638638
"Cookie": globals.bilibliCookie
639639
},
640640
base64Data: true,
641+
retries: 1,
641642
});
642643

643644
return parseDanmakuBase64(res.data);

danmu_api/sources/hanjutv.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ export default class HanjutvSource extends BaseSource {
201201
"Content-Type": "application/json",
202202
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
203203
},
204+
retries: 1,
204205
});
205206

206207
// 将当前请求的 episodes 拼接到总数组

danmu_api/sources/iqiyi.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,8 @@ export default class IqiyiSource extends BaseSource {
769769
"Content-Type": "application/xml",
770770
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
771771
},
772-
zlibMode: true
772+
zlibMode: true,
773+
retries: 1,
773774
})
774775
);
775776
}

danmu_api/sources/mango.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ export default class MangoSource extends BaseSource {
577577
"Content-Type": "application/json",
578578
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
579579
},
580+
retries: 1,
580581
})
581582
);
582583
}
@@ -600,6 +601,7 @@ export default class MangoSource extends BaseSource {
600601
"Content-Type": "application/json",
601602
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
602603
},
604+
retries: 1,
603605
})
604606
);
605607
}

danmu_api/sources/renren.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ export default class RenrenSource extends BaseSource {
146146
headers['Host'] = this.API_CONFIG.DANMU_HOST;
147147

148148
const resp = await httpGet(`https://${this.API_CONFIG.DANMU_HOST}${path}`, {
149-
headers: headers
149+
headers: headers,
150+
retries: 1,
150151
});
151152

152153
if (!resp.data) return null;
@@ -217,7 +218,8 @@ export default class RenrenSource extends BaseSource {
217218
async renrenHttpGet(url, { params = {}, headers = {} } = {}) {
218219
const u = updateQueryString(url, params)
219220
const resp = await httpGet(u, {
220-
headers: headers,
221+
headers: headers,
222+
retries: 1,
221223
});
222224
return resp;
223225
}
@@ -230,7 +232,7 @@ export default class RenrenSource extends BaseSource {
230232
const deviceId = this.generateDeviceId();
231233
const headers = this.buildSignedHeaders({ method, url, params, deviceId });
232234
const resp = await httpGet(url + "?" + sortedQueryString(params), {
233-
headers: headers,
235+
headers: headers,
234236
});
235237
return resp;
236238
}

danmu_api/sources/tencent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ export default class TencentSource extends BaseSource {
469469
"Content-Type": "application/json",
470470
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
471471
},
472+
retries: 1,
472473
})
473474
);
474475
}

danmu_api/sources/youku.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,8 @@ export default class YoukuSource extends BaseSource {
584584
"Content-Type": "application/x-www-form-urlencoded",
585585
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36",
586586
},
587-
allow_redirects: false
587+
allow_redirects: false,
588+
retries: 1,
588589
});
589590

590591
const results = [];

0 commit comments

Comments
 (0)