add apple music and spotify support

This commit is contained in:
flavjyk4 2024-08-07 22:06:15 +00:00
parent afa33c4043
commit d6d0832e19
6 changed files with 35 additions and 0 deletions

View File

@ -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')

View File

@ -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;
}

View File

@ -0,0 +1,5 @@
export default async function({}) {
return {
urls: "https://http.cat/451"
}
}

View File

@ -0,0 +1,5 @@
export default async function({}) {
return {
urls: "https://http.cat/451"
}
}

View File

@ -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"],

View File

@ -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