mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 20:59:59 +00:00
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:
parent
5bd50fd55f
commit
3e8c059a3a
3 changed files with 25 additions and 38 deletions
|
@ -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;
|
||||||
|
|
|
@ -63,29 +63,17 @@ 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) {
|
|
||||||
|
let masterM3U8 = `${masterJSONURL.split("/sep/")[0]}/sep/video/${bestVideo.id}/master.m3u8`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
urls: audioUrl ? [videoUrl, audioUrl] : videoUrl,
|
urls: masterM3U8,
|
||||||
isM3U8: audioUrl ? false : true,
|
isM3U8: true,
|
||||||
fileMetadata: fileMetadata,
|
fileMetadata: fileMetadata,
|
||||||
filenameAttributes: {
|
filenameAttributes: {
|
||||||
service: "vimeo",
|
service: "vimeo",
|
||||||
|
@ -93,10 +81,8 @@ export default async function(obj) {
|
||||||
title: fileMetadata.title,
|
title: fileMetadata.title,
|
||||||
author: fileMetadata.artist,
|
author: fileMetadata.artist,
|
||||||
resolution: `${bestVideo["width"]}x${bestVideo["height"]}`,
|
resolution: `${bestVideo["width"]}x${bestVideo["height"]}`,
|
||||||
qualityLabel: `${bestVideo["height"]}p`,
|
qualityLabel: `${resolutionMatch[bestVideo["width"]]}p`,
|
||||||
extension: "mp4"
|
extension: "mp4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { error: 'ErrorEmptyDownload' }
|
|
||||||
}
|
|
||||||
|
|
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue