odysee support

This commit is contained in:
ihatespawn 2024-05-31 13:18:26 +02:00
parent 03fda93f96
commit e88f2dc8e2
5 changed files with 43 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import twitch from "./services/twitch.js";
import rutube from "./services/rutube.js"; import rutube from "./services/rutube.js";
import dailymotion from "./services/dailymotion.js"; import dailymotion from "./services/dailymotion.js";
import loom from "./services/loom.js"; import loom from "./services/loom.js";
import odysee from "./services/odysee.js";
let freebind; let freebind;
@ -193,6 +194,11 @@ export default async function(host, patternMatch, lang, obj) {
id: patternMatch.id id: patternMatch.id
}); });
break; break;
case "odysee":
r = await odysee({
id: patternMatch.id
});
break;
default: default:
return createResponse("error", { return createResponse("error", {
t: loc(lang, 'ErrorUnsupported') t: loc(lang, 'ErrorUnsupported')

View File

@ -130,6 +130,7 @@ export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, di
case "pinterest": case "pinterest":
case "streamable": case "streamable":
case "loom": case "loom":
case "odysee":
responseType = "redirect"; responseType = "redirect";
break; break;
} }

View File

@ -0,0 +1,27 @@
import { genericUserAgent } from "../../config.js";
export default async function({ id }) {
const req = await fetch(`https://odysee.com/${id}`, {
method: "GET",
headers: {
"user-agent": genericUserAgent
}
})
.then(req => {return req.text()})
.catch(() => {});
// i couldn't find any other way to do this
var reqlines = req.split('\n');
var contentline = reqlines[reqlines.length - 32];
var videoUrl = contentline.split('"')[3];
if (videoUrl?.includes('.mp4')) {
return {
urls: videoUrl,
filename: `odysee_${id}.mp4`,
audioFilename: `odysee_${id}_audio`
}
}
return { error: 'ErrorEmptyDownload' }
}

View File

@ -1,5 +1,5 @@
{ {
"audioIgnore": ["vk", "ok", "loom"], "audioIgnore": ["vk", "ok", "loom", "odysee"],
"hlsExceptions": ["dailymotion", "vimeo", "rutube"], "hlsExceptions": ["dailymotion", "vimeo", "rutube"],
"config": { "config": {
"bilibili": { "bilibili": {
@ -117,6 +117,11 @@
"alias": "loom videos", "alias": "loom videos",
"patterns": ["share/:id"], "patterns": ["share/:id"],
"enabled": true "enabled": true
},
"odysee": {
"alias": "odysee videos",
"patterns": [":creator/:id", ":id"],
"enabled": true
} }
} }
} }

View File

@ -15,6 +15,9 @@ export const testers = {
"ok": (patternMatch) => "ok": (patternMatch) =>
patternMatch.id?.length <= 16, patternMatch.id?.length <= 16,
"odysee": (patternMatch) =>
patternMatch.id?.length <= 255,
"pinterest": (patternMatch) => "pinterest": (patternMatch) =>
patternMatch.id?.length <= 128 || patternMatch.shortLink?.length <= 32, patternMatch.id?.length <= 128 || patternMatch.shortLink?.length <= 32,