mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-23 23:09:28 +00:00
fix: do not return null if a renderer is not found
This caused the parser to return null when ads or renderers that are not implemented are present.
This commit is contained in:
@@ -106,14 +106,13 @@ class Parser {
|
||||
const keys = Object.keys(item);
|
||||
const classname = this.sanitizeClassName(keys[0]);
|
||||
|
||||
if (this.shouldIgnore(classname)) return;
|
||||
|
||||
try {
|
||||
const TargetClass = require('./classes/' + classname);
|
||||
results.push(new TargetClass(item[keys[0]]));
|
||||
} catch (err) {
|
||||
this.formatError({ classname, classdata: item[keys[0]], err });
|
||||
return null;
|
||||
if (!this.shouldIgnore(classname)) {
|
||||
try {
|
||||
const TargetClass = require('./classes/' + classname);
|
||||
results.push(new TargetClass(item[keys[0]]));
|
||||
} catch (err) {
|
||||
this.formatError({ classname, classdata: item[keys[0]], err });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,16 +121,16 @@ class Parser {
|
||||
const keys = Object.keys(data);
|
||||
const classname = this.sanitizeClassName(keys[0]);
|
||||
|
||||
if (this.shouldIgnore(classname)) return;
|
||||
|
||||
try {
|
||||
const TargetClass = require('./classes/' + classname);
|
||||
return new TargetClass(data[keys[0]]);
|
||||
} catch (err) {
|
||||
this.formatError({ classname, classdata: data[keys[0]], err });
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (!this.shouldIgnore(classname)) {
|
||||
try {
|
||||
const TargetClass = require('./classes/' + classname);
|
||||
return new TargetClass(data[keys[0]]);
|
||||
} catch (err) {
|
||||
this.formatError({ classname, classdata: data[keys[0]], err });
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static formatError({ classname, classdata, err }) {
|
||||
|
||||
Reference in New Issue
Block a user