Closed musso closed 2 years ago
Possible fix, In src/classes/Channel.ts
, line 60
this.banner = new Thumbnails().load(banner.thumbnails);
this.tvBanner = new Thumbnails().load(tvBanner.thumbnails);
this.mobileBanner = new Thumbnails().load(mobileBanner.thumbnails);
change to
this.banner = new Thumbnails().load(banner?.thumbnails || []);
this.tvBanner = new Thumbnails().load(tvBanner?.thumbnails || []);
this.mobileBanner = new Thumbnails().load(mobileBanner?.thumbnails || []);
I found that there are many similar cases existed in the library .... many of them throwing error due to accessing undefined object. Wonder if you have time to fix them or you could accept pull requests
Most of these type of bugs are easy to fix and doesn't take too much time, finding out which one causes the bug is the one that takes time. I haven't tested my library thoroughly, with every possible scenario.
I'm accepting pull requests, but you can just send your bug report here and I can fix all of them quite quickly, and should be published within days.
This should be fixed in v1, but if the issue still persists, fill free to reopen the issue.
(Also check the v1 migration guide)
When using
await youtube.getChannel("UCni1rOH6_7JL8Nm4QtZvFXw")
to crawl a channel without thumbnail, it throws errorTypeError: Cannot read property 'thumbnails' of undefined
. Better to check if it is undefined or null before accessing it. Not all channel got thumbnail or join date etc