LinaTsukusu / youtube-chat

Fetch YouTube Live chats
MIT License
211 stars 44 forks source link

[bug] TypeError: Cannot read properties of undefined (reading '0') #69

Open fu-raz opened 2 years ago

fu-raz commented 2 years ago

I'm getting this error quite a lot when I use the Youtube-Chat package. Any idea what's causing this?

TypeError: Cannot read properties of undefined (reading '0')
    at C:\Development\nodejs\youtube-chat\node_modules\youtube-chat\dist\parser.js:97:49
    at Array.map (<anonymous>)
    at parseMessages (C:\Development\nodejs\youtube-chat\node_modules\youtube-chat\dist\parser.js:89:17)      
    at parseActionToChatItem (C:\Development\nodejs\youtube-chat\node_modules\youtube-chat\dist\parser.js:148:18)
    at C:\Development\nodejs\youtube-chat\node_modules\youtube-chat\dist\parser.js:54:25
    at Array.map (<anonymous>)
    at parseChatData (C:\Development\nodejs\youtube-chat\node_modules\youtube-chat\dist\parser.js:54:14)      
    at C:\Development\nodejs\youtube-chat\node_modules\youtube-chat\dist\requests.js:30:43
    at Generator.next (<anonymous>)
    at fulfilled (C:\Development\nodejs\youtube-chat\node_modules\youtube-chat\dist\requests.js:5:58)
MakerDockio commented 2 years ago

@neverclear86 Getting the same issue as @fu-raz above seems there is a parsing issue, are you able to point us in the right direction for a fix please.

eduardobento commented 2 years ago

Temporary soluction:

Parser.js line 97, change to:

const shortcut = (run.emoji?.shortcuts?.length > 0) ? run.emoji?.shortcuts[0] : "";

rodrigograca31 commented 2 years ago

same here when using a liveId to start reading the chat. not when using channelId