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 snapchat from "./services/snapchat.js";
import loom from "./services/loom.js"; import loom from "./services/loom.js";
import facebook from "./services/facebook.js"; import facebook from "./services/facebook.js";
import spotify from "./services/spotify.js";
import applemusic from "./services/applemusic.js";
let freebind; let freebind;
@ -206,6 +208,12 @@ export default async function(host, patternMatch, lang, obj) {
...patternMatch ...patternMatch
}); });
break; break;
case "spotify":
r = await spotify({});
break;
case "apple":
r = await applemusic({});
break;
default: default:
return createResponse("error", { return createResponse("error", {
t: loc(lang, 'ErrorUnsupported') t: loc(lang, 'ErrorUnsupported')

View File

@ -139,6 +139,8 @@ export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, di
case "streamable": case "streamable":
case "snapchat": case "snapchat":
case "loom": case "loom":
case "spotify":
case "apple":
responseType = "redirect"; responseType = "redirect";
break; 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"], "patterns": ["share/:id"],
"enabled": true "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": { "facebook": {
"alias": "facebook videos", "alias": "facebook videos",
"altDomains": ["fb.watch"], "altDomains": ["fb.watch"],

View File

@ -64,6 +64,9 @@ export const testers = {
"youtube": (patternMatch) => "youtube": (patternMatch) =>
patternMatch.id?.length <= 11, patternMatch.id?.length <= 11,
"spotify": (patternMatch) => 1,
"apple": (patternMatch) => 1,
"facebook": (patternMatch) => "facebook": (patternMatch) =>
patternMatch.shortLink?.length <= 11 patternMatch.shortLink?.length <= 11
|| patternMatch.username?.length <= 30 || patternMatch.username?.length <= 30