diff --git a/src/modules/processing/matchActionDecider.js b/src/modules/processing/matchActionDecider.js index ddc07d1e..74f0f8c7 100644 --- a/src/modules/processing/matchActionDecider.js +++ b/src/modules/processing/matchActionDecider.js @@ -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": diff --git a/src/modules/processing/services/newgrounds.js b/src/modules/processing/services/newgrounds.js index 047e2f2a..371fd9aa 100644 --- a/src/modules/processing/services/newgrounds.js +++ b/src/modules/processing/services/newgrounds.js @@ -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, } }