mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-18 03:08:30 +00:00
fix video filenames
This commit is contained in:
parent
82a1f6ce45
commit
d7b4ee6c06
@ -99,7 +99,7 @@ export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, di
|
||||
|
||||
case "video":
|
||||
switch (host) {
|
||||
case "bilibili":
|
||||
case "bilibili":
|
||||
params = { type: "render" };
|
||||
break;
|
||||
case "youtube":
|
||||
|
@ -20,10 +20,26 @@ export default async function(obj) {
|
||||
json = JSON.parse(req);
|
||||
} catch { return { error: 'ErrorEmptyDownload' }; }
|
||||
const highestQuality = Object.keys(json.sources)[0];
|
||||
const video = json.sources[highestQuality][0].src
|
||||
const video = json.sources[highestQuality][0].src;
|
||||
if (!json.sources[highestQuality][0].type.includes('mp4')) {
|
||||
return { error: 'ErrorEmptyDownload' };
|
||||
}
|
||||
|
||||
let fileMetadata = {
|
||||
title: cleanString(decodeURIComponent(json.title)),
|
||||
artist: cleanString(decodeURIComponent(json.author)),
|
||||
}
|
||||
|
||||
return {
|
||||
urls: video
|
||||
urls: video,
|
||||
filenameAttributes: {
|
||||
service: "newgrounds",
|
||||
id: obj.id,
|
||||
title: fileMetadata.title,
|
||||
author: fileMetadata.artist,
|
||||
extension: 'mp4'
|
||||
},
|
||||
fileMetadata,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user