TypeError: Cannot read property 'simpleText' of undefined
wikanonymous-dev opened this issue · 4 comments
Describe the bug
Hi there! I got this error on my debugger TypeError: Cannot read property 'simpleText' of undefined
from searching some channel.
Channel is hiding the information about subscribers
I think you need add try catch for this function. Thank you
const convertSubs = (channel: any): number => {
const count = channel.subscriberCountText.simpleText.split(' ').shift();
// If there's no K, M or B at the end.
if (!isNaN(+count)) return +count;
const char = count.slice(-1);
let slicedCount = Number(count.slice(0, -1));
switch (char.toLowerCase()) {
case 'k':
slicedCount *= 1000;
break;
case 'k':
slicedCount *= 1e6;
break;
case 'b':
slicedCount *= 1e9;
break;
}
return ~~slicedCount;
};
To Reproduce
Steps to reproduce the behavior:
- Search query is
UCadOPMAkX21lbuA1yj0JfCQ
- See error
Expected behavior
It should return the channel's information with subscriberCount
is zero or just '-'
Screenshots
Versions:
- Package: 2.1.14
- Node: 10.21.0
Additional context
Add any other context about the problem here.
Thanks for reporting. Would you mind telling me what query you searched to catch this error?
Thanks for reporting. Would you mind telling me what query you searched to catch this error?
Im searching for this channel id UCadOPMAkX21lbuA1yj0JfCQ
with the option type is channel
Should be resolved in 2.1.15
. Let me know if you have any other problems. Thanks
Thanks. It works well