update: proxies that can be used to snapshot

This commit is contained in:
alikia2x (寒寒) 2025-03-09 22:02:16 +08:00
parent 7ac2d2c217
commit 8721089e7c
Signed by: alikia2x
GPG Key ID: 56209E0CCD8420C6
3 changed files with 6 additions and 4 deletions

View File

@ -282,6 +282,7 @@ class NetScheduler {
return JSON.parse(JSON.parse(rawData.body)) as R; return JSON.parse(JSON.parse(rawData.body)) as R;
} }
} catch (e) { } catch (e) {
logger.error(e, "net", "alicloudFcRequest");
throw new NetSchedulerError(`Unhandled error: Cannot proxy ${url} to ali-fc.`, "ALICLOUD_PROXY_ERR", e); throw new NetSchedulerError(`Unhandled error: Cannot proxy ${url} to ali-fc.`, "ALICLOUD_PROXY_ERR", e);
} }
} }
@ -347,13 +348,14 @@ The order of setTaskLimiter and setProviderLimiter relative to each other is fle
but both should come after addProxy and addTask to ensure proper setup and dependencies are met. but both should come after addProxy and addTask to ensure proper setup and dependencies are met.
*/ */
const regions = ["shanghai", "hangzhou", "qingdao", "beijing", "zhangjiakou", "chengdu", "shenzhen", "hohhot"];
netScheduler.addProxy("native", "native", ""); netScheduler.addProxy("native", "native", "");
for (const region of ["shanghai", "hangzhou", "qingdao", "beijing", "zhangjiakou", "chengdu", "shenzhen", "hohhot"]) { for (const region of regions) {
netScheduler.addProxy(`alicloud-${region}`, "alicloud-fc", region); netScheduler.addProxy(`alicloud-${region}`, "alicloud-fc", region);
} }
netScheduler.addTask("getVideoInfo", "bilibili", ["native"]); netScheduler.addTask("getVideoInfo", "bilibili", ["native"]);
netScheduler.addTask("getLatestVideos", "bilibili", ["native"]); netScheduler.addTask("getLatestVideos", "bilibili", ["native"]);
netScheduler.addTask("snapshotMilestoneVideo", "bilibili", "all"); netScheduler.addTask("snapshotMilestoneVideo", "bilibili", regions.map((region) => `alicloud-${region}`));
netScheduler.addTask("snapshotVideo", "bilibili", [ netScheduler.addTask("snapshotVideo", "bilibili", [
"alicloud-qingdao", "alicloud-qingdao",
"alicloud-shanghai", "alicloud-shanghai",

View File

@ -7,7 +7,7 @@ export async function getVideoDetails(aid: number): Promise<VideoDetailsData | n
const data = await netScheduler.request<VideoDetailsResponse>(url, "getVideoInfo"); const data = await netScheduler.request<VideoDetailsResponse>(url, "getVideoInfo");
const errMessage = `Error fetching metadata for ${aid}:`; const errMessage = `Error fetching metadata for ${aid}:`;
if (data.code !== 0) { if (data.code !== 0) {
logger.error(errMessage + data.message, "net", "fn:getVideoInfo"); logger.error(errMessage + data.code + "-" + data.message, "net", "fn:getVideoInfo");
return null; return null;
} }
return data.data; return data.data;

View File

@ -7,7 +7,7 @@ export async function getVideoInfo(aid: number, task: string): Promise<VideoInfo
const data = await netScheduler.request<VideoInfoResponse>(url, task); const data = await netScheduler.request<VideoInfoResponse>(url, task);
const errMessage = `Error fetching metadata for ${aid}:`; const errMessage = `Error fetching metadata for ${aid}:`;
if (data.code !== 0) { if (data.code !== 0) {
logger.error(errMessage + data.message, "net", "fn:getVideoInfo"); logger.error(errMessage + data.code + "-" + data.message, "net", "fn:getVideoInfo");
return null; return null;
} }
return data.data; return data.data;