mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-17 18:58:33 +00:00
support for epidemic sound
This commit is contained in:
parent
dcb3cf3673
commit
7bc5d3990c
@ -14,6 +14,7 @@ this list is not final and keeps expanding over time. if support for a service y
|
|||||||
| service | video + audio | only audio | only video | metadata | rich file names |
|
| service | video + audio | only audio | only video | metadata | rich file names |
|
||||||
| :-------- | :-----------: | :--------: | :--------: | :------: | :-------------: |
|
| :-------- | :-----------: | :--------: | :--------: | :------: | :-------------: |
|
||||||
| bilibili.com | ✅ | ✅ | ✅ | ➖ | ➖ |
|
| bilibili.com | ✅ | ✅ | ✅ | ➖ | ➖ |
|
||||||
|
| epidemic sound | ➖ | ✅ | ➖ | ✅ | ✅ |
|
||||||
| instagram posts & stories | ✅ | ✅ | ✅ | ➖ | ➖ |
|
| instagram posts & stories | ✅ | ✅ | ✅ | ➖ | ➖ |
|
||||||
| instagram reels | ✅ | ✅ | ✅ | ➖ | ➖ |
|
| instagram reels | ✅ | ✅ | ✅ | ➖ | ➖ |
|
||||||
| pinterest | ✅ | ✅ | ✅ | ➖ | ➖ |
|
| pinterest | ✅ | ✅ | ✅ | ➖ | ➖ |
|
||||||
|
@ -24,6 +24,7 @@ import pinterest from "./services/pinterest.js";
|
|||||||
import streamable from "./services/streamable.js";
|
import streamable from "./services/streamable.js";
|
||||||
import twitch from "./services/twitch.js";
|
import twitch from "./services/twitch.js";
|
||||||
import rutube from "./services/rutube.js";
|
import rutube from "./services/rutube.js";
|
||||||
|
import epidemicsound from "./services/epidemicsound.js";
|
||||||
|
|
||||||
export default async function(host, patternMatch, url, lang, obj) {
|
export default async function(host, patternMatch, url, lang, obj) {
|
||||||
assert(url instanceof URL);
|
assert(url instanceof URL);
|
||||||
@ -158,6 +159,11 @@ export default async function(host, patternMatch, url, lang, obj) {
|
|||||||
isAudioOnly: isAudioOnly
|
isAudioOnly: isAudioOnly
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "epidemicsound":
|
||||||
|
r = await epidemicsound({
|
||||||
|
id: patternMatch.id
|
||||||
|
});
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return apiJSON(0, { t: errorUnsupported(lang) });
|
return apiJSON(0, { t: errorUnsupported(lang) });
|
||||||
}
|
}
|
||||||
|
22
src/modules/processing/services/epidemicsound.js
Normal file
22
src/modules/processing/services/epidemicsound.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
export default async function (obj) {
|
||||||
|
let json = await fetch(`https://www.epidemicsound.com/json/track/${obj.id}`).then((r) => {
|
||||||
|
return r.status === 200 ? r.json() : false
|
||||||
|
}).catch(() => { return false });
|
||||||
|
|
||||||
|
let fileMetadata = {
|
||||||
|
title: json.title,
|
||||||
|
artist: (json.creatives.mainArtists || []).map(artist => artist.name).join(", ")
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
urls: json.stems.full.lqMp3Url,
|
||||||
|
filenameAttributes: {
|
||||||
|
service: "epidemicsound",
|
||||||
|
id: json.id,
|
||||||
|
title: fileMetadata.title,
|
||||||
|
author: fileMetadata.artist
|
||||||
|
},
|
||||||
|
isMp3: true,
|
||||||
|
fileMetadata
|
||||||
|
}
|
||||||
|
}
|
@ -106,6 +106,11 @@
|
|||||||
"tld": "ru",
|
"tld": "ru",
|
||||||
"patterns": ["video/:id", "play/embed/:id"],
|
"patterns": ["video/:id", "play/embed/:id"],
|
||||||
"enabled": true
|
"enabled": true
|
||||||
|
},
|
||||||
|
"epidemicsound": {
|
||||||
|
"alias": "epidemic sound music and sound effects",
|
||||||
|
"patterns": ["track/:id"],
|
||||||
|
"enabled": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,13 @@ export const testers = {
|
|||||||
"bilibili": (patternMatch) =>
|
"bilibili": (patternMatch) =>
|
||||||
patternMatch.id?.length <= 12,
|
patternMatch.id?.length <= 12,
|
||||||
|
|
||||||
|
"epidemicsound": (patternMatch) =>
|
||||||
|
patternMatch.id?.length === 10,
|
||||||
|
|
||||||
"instagram": (patternMatch) =>
|
"instagram": (patternMatch) =>
|
||||||
patternMatch.postId?.length <= 12
|
patternMatch.postId?.length <= 12
|
||||||
|| (patternMatch.username?.length <= 30 && patternMatch.storyId?.length <= 24),
|
|| (patternMatch.username?.length <= 30 && patternMatch.storyId?.length <= 24),
|
||||||
|
|
||||||
"ok": (patternMatch) =>
|
"ok": (patternMatch) =>
|
||||||
patternMatch.id?.length <= 16,
|
patternMatch.id?.length <= 16,
|
||||||
|
|
||||||
@ -19,12 +22,12 @@ export const testers = {
|
|||||||
patternMatch.id?.length === 32,
|
patternMatch.id?.length === 32,
|
||||||
|
|
||||||
"soundcloud": (patternMatch) =>
|
"soundcloud": (patternMatch) =>
|
||||||
(patternMatch.author?.length <= 255 && patternMatch.song?.length <= 255)
|
(patternMatch.author?.length <= 255 && patternMatch.song?.length <= 255)
|
||||||
|| patternMatch.shortLink?.length <= 32,
|
|| patternMatch.shortLink?.length <= 32,
|
||||||
|
|
||||||
"streamable": (patternMatch) =>
|
"streamable": (patternMatch) =>
|
||||||
patternMatch.id?.length === 6,
|
patternMatch.id?.length === 6,
|
||||||
|
|
||||||
"tiktok": (patternMatch) =>
|
"tiktok": (patternMatch) =>
|
||||||
patternMatch.postId?.length <= 21 || patternMatch.id?.length <= 13,
|
patternMatch.postId?.length <= 21 || patternMatch.id?.length <= 13,
|
||||||
|
|
||||||
|
@ -1171,5 +1171,14 @@
|
|||||||
"code": 200,
|
"code": 200,
|
||||||
"status": "stream"
|
"status": "stream"
|
||||||
}
|
}
|
||||||
|
}],
|
||||||
|
"epidemicsound": [{
|
||||||
|
"name": "track",
|
||||||
|
"url": "https://www.epidemicsound.com/track/NpuE3YgGmN/",
|
||||||
|
"params": {},
|
||||||
|
"expected": {
|
||||||
|
"code": 200,
|
||||||
|
"status": "stream"
|
||||||
|
}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user