You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use the livechat example, which works on 9.4.0. Here's my code:
import{Innertube,UniversalCache,YTNodes}from'youtubei.js';import{ChatAction}from'youtubei.js/dist/src/parser/youtube/LiveChat';exportasyncfunctioninitYoutube(){constyt=awaitInnertube.create({cache: newUniversalCache(false),generate_session_locally: true});constsearch=awaityt.search('Xkonti livestream',{features: ['live'],upload_date: 'today',});console.log('Searched for items: ',search)constinfo=awaityt.getInfo(search.videos[0].as(YTNodes.Video).id);console.log('Selected item: ',search)constlivechat=info.getLiveChat();livechat.on('chat-update',(action: ChatAction)=>{console.log('Received YT chat update event');if(action.is(YTNodes.AddChatItemAction)){constitem=action.as(YTNodes.AddChatItemAction).item;if(!item)returnconsole.info('Action did not have an item.',action);consthours=newDate(item.hasKey('timestamp') ? item.timestamp : Date.now()).toLocaleTimeString('en-US',{hour: '2-digit',minute: '2-digit'});switch(item.type){case'LiveChatTextMessage':
console.info(`${item.as(YTNodes.LiveChatTextMessage).author?.is_moderator ? '[MOD]' : ''}`,`${hours} - ${item.as(YTNodes.LiveChatTextMessage).author?.name.toString()}:\n`+`${item.as(YTNodes.LiveChatTextMessage).message.toString()}\n`);break;case'LiveChatPaidMessage':
console.info(`${item.as(YTNodes.LiveChatPaidMessage).author?.is_moderator ? '[MOD]' : ''}`,`${hours} - ${item.as(YTNodes.LiveChatPaidMessage).author.name.toString()}:\n`+`${item.as(YTNodes.LiveChatPaidMessage).message.toString()}\n`,`${item.as(YTNodes.LiveChatPaidMessage).purchase_amount}\n`);break;case'LiveChatPaidSticker':
console.info(`${item.as(YTNodes.LiveChatPaidSticker).author?.is_moderator ? '[MOD]' : ''}`,`${hours} - ${item.as(YTNodes.LiveChatPaidSticker).author.name.toString()}:\n`+`${item.as(YTNodes.LiveChatPaidSticker).purchase_amount}\n`);break;default:
console.debug(action);break;}}});livechat.start();}
After executing await initYoutube(); the error shows up :(
Failure Logs
1 | (function (entry, fetcher)
^
SyntaxError: Export named 'setGlobalDispatcher' not found in module 'undici'.
1 | (function (entry, fetcher)
^
SyntaxError: Export named 'setGlobalDispatcher' not found in module 'undici'.
Expected behavior
It should work just like it does on 9.4.0.
Current behavior
Currently there are errors.
Version
Default
Anything else?
Runtime: Bun 1.1.13
OS: Windows
WebFramework: Elysia.js
Checklist
I am running the latest version.
I checked the documentation and found no answer.
I have searched the existing issues and made sure this is not a duplicate.
I have provided sufficient information.
The text was updated successfully, but these errors were encountered:
Steps to reproduce
I tried to use the livechat example, which works on 9.4.0. Here's my code:
After executing
await initYoutube();
the error shows up :(Failure Logs
Expected behavior
It should work just like it does on 9.4.0.
Current behavior
Currently there are errors.
Version
Default
Anything else?
Runtime: Bun 1.1.13
OS: Windows
WebFramework: Elysia.js
Checklist
The text was updated successfully, but these errors were encountered: