diff --git a/api/src/processing/match.js b/api/src/processing/match.js index 360ed532..543b451d 100644 --- a/api/src/processing/match.js +++ b/api/src/processing/match.js @@ -29,6 +29,7 @@ import loom from "./services/loom.js"; import facebook from "./services/facebook.js"; import bluesky from "./services/bluesky.js"; import xiaohongshu from "./services/xiaohongshu.js"; +import terabox from "./services/terabox.js"; let freebind; @@ -268,6 +269,10 @@ export default async function({ host, patternMatch, params, authType }) { }); break; + case "terabox": + r = await terabox(fetchInfo); // Assuming fetchInfo is appropriate, adjust if needed + break; + default: return createResponse("error", { code: "error.api.service.unsupported" diff --git a/api/src/processing/service-config.js b/api/src/processing/service-config.js index 3ffcf10a..f6b9b17a 100644 --- a/api/src/processing/service-config.js +++ b/api/src/processing/service-config.js @@ -213,6 +213,12 @@ export const services = { "v/:id" ], subdomains: ["music", "m"], + }, + terabox: { + patterns: [ + "s/:id", + ], + altDomains: ["terabox.app"], // Assuming .app is an alternative, can be adjusted } } diff --git a/api/src/processing/service-patterns.js b/api/src/processing/service-patterns.js index fd6daef9..cc8835f5 100644 --- a/api/src/processing/service-patterns.js +++ b/api/src/processing/service-patterns.js @@ -79,4 +79,7 @@ export const testers = { "xiaohongshu": pattern => pattern.id?.length <= 24 && pattern.token?.length <= 64 || pattern.shareId?.length <= 24, + + "terabox": pattern => + pattern.id?.length <= 32, // Placeholder, adjust as needed } diff --git a/api/src/processing/services/terabox.js b/api/src/processing/services/terabox.js new file mode 100644 index 00000000..172de1db --- /dev/null +++ b/api/src/processing/services/terabox.js @@ -0,0 +1,23 @@ +// Terabox service handler +// This is a placeholder and will need to be implemented based on Terabox's API or download mechanism. + +export default async function terabox(fetchInfo) { + const { url } = fetchInfo; + + // Placeholder: Return a direct link or an error if processing fails + // Actual implementation will depend on how Terabox shares files (e.g., direct download, API call) + // For now, let's assume it might be a direct link or requires simple transformation. + + // Example: if Terabox links are direct downloads or can be transformed easily + // if (url.includes("terabox.com/s/")) { + // return { + // picker: [{ + // url: url, // This might need modification + // title: "Terabox File" // Placeholder title + // }], + // title: "Terabox Download" + // }; + // } + + return { error: "terabox.unsupported_url" }; +}