alexankitty / Youtube-WS-Chat-Wrapper

Pulls youtube chat without using quota for use in a chat overlay. Optionally forwards messages between twitch and youtube. Implements websockets.
6 stars 0 forks source link

Live Stream was not found #1

Open SpacemannFinn opened 1 year ago

SpacemannFinn commented 1 year ago

Been having trouble getting it to find the live stream I'm doing I think. I believe I've done everything right and this is still happening.

node app.js
[08:49] info: Connecting to irc-ws.chat.twitch.tv on port 443..
[08:49] info: Sending authentication to server..
[08:49] info: Connected to server.
connection received from: ::ffff:127.0.0.1
Error: Live Stream was not found
    at getOptionsFromLivePage (C:\Users\Abstract\Downloads\Youtube-WS-Chat-Wrapper-master\node_modules\youtube-chat\dist\parser.js:11:15)
    at C:\Users\Abstract\Downloads\Youtube-WS-Chat-Wrapper-master\node_modules\youtube-chat\dist\requests.js:41:52
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\Abstract\Downloads\Youtube-WS-Chat-Wrapper-master\node_modules\youtube-chat\dist\requests.js:5:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Connection closed: ::ffff:127.0.0.1 

This is the error I got in the console and I could use some assistance. I wish this had a fallback that was slower but was at least a little easier to set up. Unless it does and I missed it, love Holo Chat and I think it's a perfect implementation and would love it to work great for youtube rn too,

alexankitty commented 1 year ago

No this is really the only way to do youtube chat. Most of the issues with youtube in general have to stem with how garbage the API is, so what this does is scrape the stream instead. The API is only utilized for finding the channel name, caching it, and forwarding messages from twitch to youtube.

This actually looks like an issue with the module I'm using to scrape the streams not being able to find the channel for some reason. I'll look into it and see what I can figure out.

alexankitty commented 1 year ago

It appears to work when I manually specify the livestream ID...

alexankitty commented 1 year ago

Never mind, seems to work for me with my test.html. How are you testing on your end? I had to switch the parameter in the test from Id to ChannelName. (I'm guessing I changed that when I built out the integration with Holo Chat.

SpacemannFinn commented 1 year ago

I just went into the html file and changed the id to my channel name. Is there a place for me to specify this channelID elsewhere? My channel is webcomicshub and I am using that as the name. If using a name should I use @webcomicshub like youtube is using now? or should I find the random string ID for my channel?

On Thu, 26 Oct 2023, 14:01 Alexandra, @.***> wrote:

Never mind, seems to work for me with my test.html. How are you testing on your end? I had to switch the parameter in the test from Id to ChannelName. (I'm guessing I changed that when I built out the integration with Holo Chat.

— Reply to this email directly, view it on GitHub https://github.com/alexankitty/Youtube-WS-Chat-Wrapper/issues/1#issuecomment-1781078605, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHCLKMKKOFXTNHN4DGSDPSTYBJNLFAVCNFSM6AAAAAA6QV3NCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBRGA3TQNRQGU . You are receiving this because you authored the thread.Message ID: @.***>

alexankitty commented 1 year ago

It needs to specifically be set to channelName in the html otherwise it will try to look up the livestream ID. Reviewing it, I don't really have a way of checking for a livestream ID without assuming that everyone with 11 character long names is a livestream ID lol.

        const channelName = 'LofiGirl';
        const chatSocket = new WebSocket('ws://127.0.0.1:8081')
        const forward = 'alexankitty'
        const params = {channelName: channelName, forward: forward}

Can switch that section out to this and it will work.

alexankitty commented 1 year ago

I added a11f20d181057cb51c910d2bd9e61c5a0ca32720 and a4ebabe49a3ed7146595c1968956de18fbcbfd36 which should fix it.

SpacemannFinn commented 1 year ago

Okay it's connected seemingly no more "livestream not found" error then I went to 127.0.0.1:8081 and it says upgrade required.

How do I get the ytchat.html file live on the correct port? I'm using the build in go live thing on vscode. Is there something else you are using to locally host the html? I ask this because I am having trouble with the last step of connecting it to Holo-Chat so I can have my combined youtube/twitch chat

Cause when I use the inbuild localhost tool it shows me a webpage and the webpage is showing me youtube chat and that's great. But when I take the 127.0.0.1:5500 url and put it into Holo-Chat, I see no chat

alexankitty commented 1 year ago

443 is for https. This project doesn't use https as it would require adding additional information for certificate signing, accepting the certificate, and so on. I put the websocket server specifically on 8081 since port 8080-8089 tend to be used as additional 80 ports (the port that http is handled over)

The upgrade required message is more than likely related to you connecting to an unencrypted websocket from an encrypted (https) webpage. I'm guessing you're using the https://alexankitty.github.io/Holo-Chat/Holo-Chat.html endpoint for this? I don't have a way to make it run over http, so what I would recommend doing instead is installing light-server from npm via npm i -g light-server (run as administrator or via sudo) then setting up a system level service either with nssm if you're on windows, or adding a service entry to systemd if you're on linux. The command you will want to run is light-server -s . -p 8080 and make sure your working directory is set to whichever folder you have holo-chat stored in. This also gives you the added functionality of using the yaml to configure the chat page, or continue to use enter to do so.

For the websocket port on the config it should be ws://serverip:8081, if both are on the same computer then ws://127.0.0.1:8081 is what you want.

SpacemannFinn commented 1 year ago

Ah I see that makes sense, also I have added a little more to my earlier comment. I will begin installing light server, thank you

alexankitty commented 1 year ago

Made a change to my message to reflect your edit.

SpacemannFinn commented 1 year ago

Okay I've got Holo Chat working locally and the wrapper running as well, is there a process for combining them together that I'm not understanding?

alexankitty commented 1 year ago

Your -s argument needs to be set to the directory you want to serve. In my example I use . And set the working directory accordingly. I believe you can also put the path to holo chat in quotes as well.

On Thu, Oct 26, 2023, 08:50 Nen @.***> wrote:

Okay I've been trying to get Holo Chat running locally and I do not know if I am just blind but I tried installing lightserver and it didn't work.

C:\ > light-server -s -p 4000 light-server is listening at http://0.0.0.0:4000 serving static dir: -p

GET /Holo-Chat.html 404 6.663 ms - -

Those GET requests just error out, maybe I'm doing something wrong. I couldn't even initialise NPM in it because I do not know what the main file in there is

— Reply to this email directly, view it on GitHub https://github.com/alexankitty/Youtube-WS-Chat-Wrapper/issues/1#issuecomment-1781286836, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK3GNYBMF45BCIMAEIPLD33YBJ2EZAVCNFSM6AAAAAA6QV3NCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBRGI4DMOBTGY . You are receiving this because you commented.Message ID: @.***>

SpacemannFinn commented 1 year ago

Okay suddenly it's all working holy shit. Thanks so much for your patience

SpacemannFinn commented 1 year ago

Just want to ask about one thing you said. You said something about needing more tokens because the OAUTH would only let through 500 messages or something. Have you found a solution to that?

alexankitty commented 1 year ago

Sorry I hadn't seen this. The only work around would be multiple API keys. I have no idea why Google thinks that's an acceptable limit but that's why things like restream aren't real time.