mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-14 12:19:59 +00:00
youtube: update stub handling
This commit is contained in:
parent
dd56ae60e7
commit
66b3697b24
1 changed files with 12 additions and 7 deletions
|
@ -23,7 +23,9 @@ const c = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function(o) {
|
export default async function(o) {
|
||||||
let info, isDubbed, quality = o.quality === "max" ? "9000" : o.quality; //set quality 9000(p) to be interpreted as max
|
let info, isDubbed,
|
||||||
|
quality = o.quality === "max" ? "9000" : o.quality; // 9000(p) - max quality
|
||||||
|
|
||||||
function qual(i) {
|
function qual(i) {
|
||||||
if (!i.quality_label) {
|
if (!i.quality_label) {
|
||||||
return;
|
return;
|
||||||
|
@ -43,6 +45,15 @@ export default async function(o) {
|
||||||
if (info.playability_status.status !== 'OK') return { error: 'ErrorYTUnavailable' };
|
if (info.playability_status.status !== 'OK') return { error: 'ErrorYTUnavailable' };
|
||||||
if (info.basic_info.is_live) return { error: 'ErrorLiveVideo' };
|
if (info.basic_info.is_live) return { error: 'ErrorLiveVideo' };
|
||||||
|
|
||||||
|
// return a critical error if returned video is "Video Not Available"
|
||||||
|
// or a similar stub by youtube
|
||||||
|
if (info.basic_info.id !== o.id) {
|
||||||
|
return {
|
||||||
|
error: 'ErrorCantConnectToServiceAPI',
|
||||||
|
critical: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let bestQuality, hasAudio;
|
let bestQuality, hasAudio;
|
||||||
|
|
||||||
let adaptive_formats = info.streaming_data.adaptive_formats.filter(e =>
|
let adaptive_formats = info.streaming_data.adaptive_formats.filter(e =>
|
||||||
|
@ -89,12 +100,6 @@ export default async function(o) {
|
||||||
youtubeDubName: isDubbed ? o.dubLang : false
|
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 {
|
if (hasAudio && o.isAudioOnly) return {
|
||||||
type: "render",
|
type: "render",
|
||||||
isAudioOnly: true,
|
isAudioOnly: true,
|
||||||
|
|
Loading…
Reference in a new issue