修复360不能访问的情况下不返回其他站点信息的问题
This commit is contained in:
1 parent
62eca9a9ef
commit
439b3cd54b
3 files changed
+39
-14
No files matched your search
@@ -124,6 +124,7 @@
|
||||
|
||||
### 优化点
|
||||
Settings > Functions > Advanced Setting > Function Region 切换为 Hong Kong,能提高访问速度,体验更优
|
||||
> hk有可能访问不了360,也可以尝试切其他region,如新加坡等
|
||||
|
||||
## 部署到 腾讯云 edgeone pages 【推荐】
|
||||
|
||||
@@ -134,7 +135,7 @@ Settings > Functions > Advanced Setting > Function Region 切换为 Hong Kong,
|
||||
>
|
||||
> 示例请求:`https://{your_domian}/{TOKEN}/api/v2/search/anime?keyword=子夜归`确认是否部署成功
|
||||
>
|
||||
> 部署的时候项目加速区域最好设置为"全球可用区(不含中国大陆)",不然不绑定自定义域名貌似只能生成3小时的预览链接?https://edgeone.cloud.tencent.com/pages/document/175191784523485184
|
||||
> 部署的时候项目加速区域最好设置为"全球可用区(不含中国大陆)",不然不绑定自定义域名貌似只能生成3小时的预览链接?[相关文档](https://edgeone.cloud.tencent.com/pages/document/175191784523485184)
|
||||
>
|
||||
> 也可直接用国际站的部署按钮一键部署,默认选择"全球可用区(不含中国大陆)" [](https://edgeone.ai/pages/new?template=https://github.com/huangxd-/danmu_api&project-name=danmu-api&root-directory=.%2F&env=TOKEN)
|
||||
>
|
||||
@@ -204,7 +205,6 @@ danmu_api/
|
||||
- cloudflare貌似被哔风控了。
|
||||
- 如果想更换兜底第三方弹幕服务器,请添加环境变量`OTHER_SERVER`,示例`https://api.danmu.icu`。
|
||||
- 如果想更换vod站点,请添加环境变量`VOD_SERVER`,示例`https://www.caiji.cyou`。
|
||||
- 会返回所有跟title匹配的影片,所以主要使用场景是手动弹幕搜索场景。
|
||||
- 推荐vercel和claw部署,cloudflare好像不稳定,当然最稳定还是自己本地docker部署最佳。
|
||||
|
||||
### 📈项目 Star 数增长趋势
|
||||
|
||||
+4
-4
@@ -320,7 +320,7 @@ async function get360Animes(title) {
|
||||
return animes;
|
||||
} catch (error) {
|
||||
log("error", `get360Animes error: ${error.message}`);
|
||||
throw error;
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ async function get360Zongyi(entId, site, year) {
|
||||
return links;
|
||||
} catch (error) {
|
||||
log("error", `get360Animes error: ${error.message}`);
|
||||
throw error;
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2938,5 +2938,5 @@ export async function vercelHandler(req, res) {
|
||||
}
|
||||
|
||||
// 为了测试导出 handleRequest
|
||||
export { handleRequest, searchAnime, searchEpisodes, matchAnime, getBangumi, getComment, fetchTencentVideo, fetchIqiyi, fetchMangoTV,
|
||||
fetchBilibili, fetchYouku, fetchOtherServer, httpGet, httpPost };
|
||||
export { handleRequest, searchAnime, searchEpisodes, matchAnime, getBangumi, getComment, fetchTencentVideo, fetchIqiyi,
|
||||
fetchMangoTV, fetchBilibili, fetchYouku, fetchOtherServer, httpGet, httpPost };
|
||||
@@ -1,7 +1,7 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert').strict;
|
||||
const { handleRequest, searchAnime, matchAnime, getBangumi, getComment, fetchTencentVideo, fetchIqiyi, fetchMangoTV,
|
||||
fetchBilibili, fetchYouku, fetchOtherServer, httpGet, httpPost } = require('./worker');
|
||||
const { handleRequest, searchAnime, matchAnime, searchEpisode, getBangumi, getComment, fetchTencentVideo, fetchIqiyi,
|
||||
fetchMangoTV, fetchBilibili, fetchYouku, fetchOtherServer, httpGet, httpPost } = require('./worker');
|
||||
|
||||
// Mock Request class for testing
|
||||
class MockRequest {
|
||||
@@ -97,8 +97,35 @@ test('worker.js API endpoints', async (t) => {
|
||||
// assert(commentData.count > 0, `Expected commentData.count > 0, but got ${commentData.count}`);
|
||||
// });
|
||||
|
||||
// 测试 POST /api/v2/match 接口
|
||||
await t.test('POST /api/v2/match for matching anime', async () => {
|
||||
// // 测试 POST /api/v2/match 接口
|
||||
// await t.test('POST /api/v2/match for matching anime', async () => {
|
||||
// // 构造请求体
|
||||
// const requestBody = {
|
||||
// "fileName": "生万物 S01E28",
|
||||
// "fileHash": "1234567890",
|
||||
// "fileSize": 0,
|
||||
// "videoDuration": 0,
|
||||
// "matchMode": "fileNameOnly"
|
||||
// };
|
||||
//
|
||||
// // 模拟 POST 请求
|
||||
// const matchUrl = `${urlPrefix}/${token}/api/v2/match`; // 注意路径与 handleRequest 中匹配
|
||||
// const req = new MockRequest(matchUrl, { method: 'POST', body: requestBody });
|
||||
//
|
||||
// // 调用 handleRequest 来处理 POST 请求
|
||||
// const res = await handleRequest(req);
|
||||
//
|
||||
// // 解析响应
|
||||
// const responseBody = await parseResponse(res);
|
||||
// console.log(responseBody);
|
||||
//
|
||||
// // 验证响应状态
|
||||
// assert.equal(res.status, 200);
|
||||
// assert.deepEqual(responseBody.success, true);
|
||||
// });
|
||||
|
||||
// 测试 GET /api/v2/search/episodes 接口
|
||||
await t.test('GET /api/v2/search/episodes for search episodes', async () => {
|
||||
// 构造请求体
|
||||
const requestBody = {
|
||||
"fileName": "生万物 S01E28",
|
||||
@@ -108,11 +135,9 @@ test('worker.js API endpoints', async (t) => {
|
||||
"matchMode": "fileNameOnly"
|
||||
};
|
||||
|
||||
// 模拟 POST 请求
|
||||
const matchUrl = `${urlPrefix}/${token}/api/v2/match`; // 注意路径与 handleRequest 中匹配
|
||||
const req = new MockRequest(matchUrl, { method: 'POST', body: requestBody });
|
||||
const matchUrl = `${urlPrefix}/${token}/api/v2/search/episodes?anime=子夜归`;
|
||||
const req = new MockRequest(matchUrl, { method: 'GET' });
|
||||
|
||||
// 调用 handleRequest 来处理 POST 请求
|
||||
const res = await handleRequest(req);
|
||||
|
||||
// 解析响应
|
||||
|
||||
Reference in new issue
Block a user