vimeo: add support for private videos

This commit is contained in:
dumbmoron 2024-03-04 23:26:14 +00:00
parent 7420337ea2
commit 52e6a40641
No known key found for this signature in database
GPG key ID: C59997C76C6A8E5F
5 changed files with 20 additions and 3 deletions

View file

@ -104,6 +104,7 @@ export default async function(host, patternMatch, url, lang, obj) {
case "vimeo":
r = await vimeo({
id: patternMatch.id.slice(0, 11),
password: patternMatch.password,
quality: obj.vQuality,
isAudioOnly: isAudioOnly,
forceDash: isAudioOnly ? true : obj.vimeoDash

View file

@ -28,7 +28,14 @@ export default async function(obj) {
let quality = obj.quality === "max" ? "9000" : obj.quality;
if (!quality || obj.isAudioOnly) quality = "9000";
let api = await fetch(`https://player.vimeo.com/video/${obj.id}/config`).then((r) => { return r.json() }).catch(() => { return false });
const url = new URL(`https://player.vimeo.com/video/${obj.id}/config`);
if (obj.password) {
url.searchParams.set('h', obj.password);
}
let api = await fetch(url)
.then(r => r.json())
.catch(() => {});
if (!api) return { error: 'ErrorCouldntFetch' };
let downloadType = "dash";

View file

@ -64,7 +64,7 @@
"enabled": false
},
"vimeo": {
"patterns": [":id", "video/:id"],
"patterns": [":id", "video/:id", ":id/:password"],
"enabled": true,
"bestAudio": "mp3"
},

View file

@ -42,7 +42,8 @@ export const testers = {
patternMatch.id?.length < 20,
"vimeo": (patternMatch) =>
patternMatch.id?.length <= 11,
patternMatch.id?.length <= 11
&& (!patternMatch.password || patternMatch.password.length < 16),
"vine": (patternMatch) =>
patternMatch.id?.length <= 12,

View file

@ -847,6 +847,14 @@
"code": 200,
"status": "stream"
}
}, {
"name": "private video",
"url": "https://vimeo.com/903115595/f14d06da38",
"params": {},
"expected": {
"code": 200,
"status": "stream"
}
}],
"reddit": [{
"name": "video with audio",