diff --git a/package.json b/package.json index d1d0a230..c4b03eb4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cobalt", "description": "save what you love", - "version": "7.7.4", + "version": "7.7.5", "author": "wukko", "exports": "./src/cobalt.js", "type": "module", diff --git a/src/modules/processing/match.js b/src/modules/processing/match.js index feb91e34..86b6af82 100644 --- a/src/modules/processing/match.js +++ b/src/modules/processing/match.js @@ -151,9 +151,15 @@ export default async function(host, patternMatch, url, lang, obj) { if (r.isAudioOnly) isAudioOnly = true; let isAudioMuted = isAudioOnly ? false : obj.isAudioMuted; - if (r.error) return apiJSON(0, { - t: Array.isArray(r.error) ? loc(lang, r.error[0], r.error[1]) : loc(lang, r.error) - }) + if (r.error && r.critical) + return apiJSON(6, { t: loc(lang, r.error) }) + + if (r.error) + return apiJSON(0, { + t: Array.isArray(r.error) + ? loc(lang, r.error[0], r.error[1]) + : loc(lang, r.error) + }) return matchActionDecider(r, host, obj.aFormat, isAudioOnly, lang, isAudioMuted, disableMetadata, obj.filenamePattern) } catch (e) { diff --git a/src/modules/processing/services/youtube.js b/src/modules/processing/services/youtube.js index 4e58e5eb..93b7b7a3 100644 --- a/src/modules/processing/services/youtube.js +++ b/src/modules/processing/services/youtube.js @@ -83,6 +83,12 @@ export default async function(o) { youtubeDubName: isDubbed ? o.dubLang : false } + if (filenameAttributes.title === "Video Not Available" && filenameAttributes.author === "YouTube Viewers") + return { + error: 'ErrorCantConnectToServiceAPI', + critical: true + } + if (hasAudio && o.isAudioOnly) return { type: "render", isAudioOnly: true, diff --git a/src/modules/sub/utils.js b/src/modules/sub/utils.js index 111cb6c8..e165a68a 100644 --- a/src/modules/sub/utils.js +++ b/src/modules/sub/utils.js @@ -35,11 +35,13 @@ export function apiJSON(type, obj) { break; } return { status: 200, body: { status: "picker", pickerType: pickerType, picker: obj.picker, audio: audio } }; + case 6: // critical error, action should be taken by balancer/other server software + return { status: 500, body: { status: "error", text: obj.t, critical: true } }; default: return { status: 400, body: { status: "error", text: "Bad Request" } }; } } catch (e) { - return { status: 500, body: { status: "error", text: "Internal Server Error" } }; + return { status: 500, body: { status: "error", text: "Internal Server Error", critical: true } }; } } export function metadataManager(obj) {