vimeo: fix parsing and resolution in filename

- all videos/audios should now be downloadable
- proper resolution is now displayed in basic and pretty filename styles
This commit is contained in:
wukko 2023-12-02 21:52:38 +06:00
parent 5bd50fd55f
commit 3e8c059a3a
3 changed files with 25 additions and 38 deletions

View file

@ -145,10 +145,6 @@ export default function(r, host, audioFormat, isAudioOnly, lang, isAudioMuted, d
} else if (audioFormat === "best") { } else if (audioFormat === "best") {
audioFormat = "m4a"; audioFormat = "m4a";
copy = true; copy = true;
if (!r.filenameAttributes && r.audioFilename.includes("twitterspaces")) {
audioFormat = "mp3"
copy = false
}
} }
if (r.isM3U8 || host === "vimeo") { if (r.isM3U8 || host === "vimeo") {
copy = false; copy = false;

View file

@ -63,40 +63,26 @@ export default async function(obj) {
if (!masterJSON) return { error: 'ErrorCouldntFetch' }; if (!masterJSON) return { error: 'ErrorCouldntFetch' };
if (!masterJSON.video) return { error: 'ErrorEmptyDownload' }; if (!masterJSON.video) return { error: 'ErrorEmptyDownload' };
let type = "parcel"; let masterJSON_Video = masterJSON.video.sort((a, b) => Number(b.width) - Number(a.width)).filter(a => a['format'] === "mp42"),
if (masterJSON.base_url === "../") type = "chop";
let masterJSON_Video = masterJSON.video.sort((a, b) => Number(b.width) - Number(a.width)),
bestVideo = masterJSON_Video[0]; bestVideo = masterJSON_Video[0];
if (Number(quality) < Number(resolutionMatch[bestVideo["width"]])) bestVideo = masterJSON_Video.find(i => resolutionMatch[i["width"]] === quality); if (Number(quality) < Number(resolutionMatch[bestVideo["width"]])) {
bestVideo = masterJSON_Video.find(i => resolutionMatch[i["width"]] === quality)
let videoUrl, audioUrl, baseUrl = masterJSONURL.split("/sep/")[0];
switch (type) {
case "parcel":
let masterJSON_Audio = masterJSON.audio.sort((a, b) => Number(b.bitrate) - Number(a.bitrate)).filter(a => a['mime_type'] === "audio/mp4"),
bestAudio = masterJSON_Audio[0];
videoUrl = `${baseUrl}/parcel/video/${bestVideo.index_segment.split('?')[0]}`,
audioUrl = `${baseUrl}/parcel/audio/${bestAudio.index_segment.split('?')[0]}`;
break;
case "chop":
videoUrl = `${baseUrl}/sep/video/${bestVideo.id}/master.m3u8`;
break;
} }
if (videoUrl) {
return { let masterM3U8 = `${masterJSONURL.split("/sep/")[0]}/sep/video/${bestVideo.id}/master.m3u8`;
urls: audioUrl ? [videoUrl, audioUrl] : videoUrl,
isM3U8: audioUrl ? false : true, return {
fileMetadata: fileMetadata, urls: masterM3U8,
filenameAttributes: { isM3U8: true,
service: "vimeo", fileMetadata: fileMetadata,
id: obj.id, filenameAttributes: {
title: fileMetadata.title, service: "vimeo",
author: fileMetadata.artist, id: obj.id,
resolution: `${bestVideo["width"]}x${bestVideo["height"]}`, title: fileMetadata.title,
qualityLabel: `${bestVideo["height"]}p`, author: fileMetadata.artist,
extension: "mp4" resolution: `${bestVideo["width"]}x${bestVideo["height"]}`,
} qualityLabel: `${resolutionMatch[bestVideo["width"]]}p`,
extension: "mp4"
} }
} }
return { error: 'ErrorEmptyDownload' }
} }

View file

@ -122,10 +122,15 @@ export function streamAudioOnly(streamInfo, res) {
try { try {
let args = [ let args = [
'-loglevel', '-8', '-loglevel', '-8'
]
if (streamInfo.service === "twitter") {
args.push('-seekable', '0')
}
args.push(
'-i', streamInfo.urls, '-i', streamInfo.urls,
'-vn' '-vn'
] )
if (streamInfo.metadata) { if (streamInfo.metadata) {
args = args.concat(metadataManager(streamInfo.metadata)) args = args.concat(metadataManager(streamInfo.metadata))