diff --git a/src/modules/processing/match.js b/src/modules/processing/match.js index 6e600cf0..356da563 100644 --- a/src/modules/processing/match.js +++ b/src/modules/processing/match.js @@ -27,6 +27,8 @@ import dailymotion from "./services/dailymotion.js"; import snapchat from "./services/snapchat.js"; import loom from "./services/loom.js"; import facebook from "./services/facebook.js"; +import spotify from "./services/spotify.js"; +import applemusic from "./services/applemusic.js"; let freebind; @@ -206,6 +208,12 @@ export default async function(host, patternMatch, lang, obj) { ...patternMatch }); break; + case "spotify": + r = await spotify({}); + break; + case "apple": + r = await applemusic({}); + break; default: return createResponse("error", { t: loc(lang, 'ErrorUnsupported') diff --git a/src/modules/processing/matchActionDecider.js b/src/modules/processing/matchActionDecider.js index 7643d491..47064740 100644 --- a/src/modules/processing/matchActionDecider.js +++ b/src/modules/processing/matchActionDecider.js @@ -139,6 +139,8 @@ export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, di case "streamable": case "snapchat": case "loom": + case "spotify": + case "apple": responseType = "redirect"; break; } diff --git a/src/modules/processing/services/applemusic.js b/src/modules/processing/services/applemusic.js new file mode 100644 index 00000000..7af5dec7 --- /dev/null +++ b/src/modules/processing/services/applemusic.js @@ -0,0 +1,5 @@ +export default async function({}) { + return { + urls: "https://http.cat/451" + } +} diff --git a/src/modules/processing/services/spotify.js b/src/modules/processing/services/spotify.js new file mode 100644 index 00000000..7af5dec7 --- /dev/null +++ b/src/modules/processing/services/spotify.js @@ -0,0 +1,5 @@ +export default async function({}) { + return { + urls: "https://http.cat/451" + } +} diff --git a/src/modules/processing/servicesConfig.json b/src/modules/processing/servicesConfig.json index 6955a946..a87fa1c4 100644 --- a/src/modules/processing/servicesConfig.json +++ b/src/modules/processing/servicesConfig.json @@ -125,6 +125,18 @@ "patterns": ["share/:id"], "enabled": true }, + "spotify": { + "alias": "spotify music", + "patterns": ["album/:id", "track/:id", "embed/track/:id"], + "subdomains": ["open"], + "enabled": true + }, + "apple": { + "alias": "apple music", + "patterns": [":country/album/:albumname/:id"], + "subdomains": ["music"], + "enabled": true + }, "facebook": { "alias": "facebook videos", "altDomains": ["fb.watch"], diff --git a/src/modules/processing/servicesPatternTesters.js b/src/modules/processing/servicesPatternTesters.js index 48f953c1..baa21627 100644 --- a/src/modules/processing/servicesPatternTesters.js +++ b/src/modules/processing/servicesPatternTesters.js @@ -64,6 +64,9 @@ export const testers = { "youtube": (patternMatch) => patternMatch.id?.length <= 11, + "spotify": (patternMatch) => 1, + "apple": (patternMatch) => 1, + "facebook": (patternMatch) => patternMatch.shortLink?.length <= 11 || patternMatch.username?.length <= 30