vimeo: clean up & fix 144p quality
This commit is contained in:
parent
cc4abbb3e2
commit
850877369c
1 changed files with 17 additions and 14 deletions
|
@ -4,21 +4,22 @@ import { cleanString } from '../../sub/utils.js';
|
||||||
import HLS from "hls-parser";
|
import HLS from "hls-parser";
|
||||||
|
|
||||||
const resolutionMatch = {
|
const resolutionMatch = {
|
||||||
"3840": "2160",
|
"3840": 2160,
|
||||||
"2732": "1440",
|
"2732": 1440,
|
||||||
"2560": "1440",
|
"2560": 1440,
|
||||||
"2048": "1080",
|
"2048": 1080,
|
||||||
"1920": "1080",
|
"1920": 1080,
|
||||||
"1366": "720",
|
"1366": 720,
|
||||||
"1280": "720",
|
"1280": 720,
|
||||||
"960": "480",
|
"960": 480,
|
||||||
"640": "360",
|
"640": 360,
|
||||||
"426": "240"
|
"426": 240
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function(obj) {
|
export default async function(obj) {
|
||||||
let quality = obj.quality === "max" ? "9000" : obj.quality;
|
let quality = obj.quality === "max" ? 9000 : Number(obj.quality);
|
||||||
if (!quality || obj.isAudioOnly) quality = "9000";
|
if (quality < 240) quality = 240;
|
||||||
|
if (!quality || obj.isAudioOnly) quality = 9000;
|
||||||
|
|
||||||
const url = new URL(`https://player.vimeo.com/video/${obj.id}/config`);
|
const url = new URL(`https://player.vimeo.com/video/${obj.id}/config`);
|
||||||
if (obj.password) {
|
if (obj.password) {
|
||||||
|
@ -52,9 +53,9 @@ export default async function(obj) {
|
||||||
if (!variants) return { error: 'ErrorEmptyDownload' };
|
if (!variants) return { error: 'ErrorEmptyDownload' };
|
||||||
|
|
||||||
let bestQuality;
|
let bestQuality;
|
||||||
if (Number(quality) < Number(resolutionMatch[variants[0].resolution.width])) {
|
if (quality < resolutionMatch[variants[0].resolution.width]) {
|
||||||
bestQuality = variants.find(v =>
|
bestQuality = variants.find(v =>
|
||||||
(Number(quality) === Number(resolutionMatch[v.resolution.width]))
|
(quality === resolutionMatch[v.resolution.width])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!bestQuality) bestQuality = variants[0];
|
if (!bestQuality) bestQuality = variants[0];
|
||||||
|
@ -71,6 +72,8 @@ export default async function(obj) {
|
||||||
urls,
|
urls,
|
||||||
expandLink(audioPath)
|
expandLink(audioPath)
|
||||||
]
|
]
|
||||||
|
} else if (obj.isAudioOnly) {
|
||||||
|
return { error: 'ErrorEmptyDownload' };
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue