The simplest chat logger for streams on ViewHub(NodeJS, without auth) – Mikulski
Site Overlay

The simplest chat logger for streams on ViewHub(NodeJS, without auth)

DISCLAIMER:
I am not a programmer, but only an enthusiastic copy-paster who shares what he could figure out. It is possible that knowledgeable experts may find some points or formulations erroneous or ridiculous.
This material is for informational purposes only.

A guide on how to connect to chats on the ViewHub site and receive all events from there (follow, unfollow, donation, current viewers). Maybe it will be useful for someone to create self-made widgets or multichat.

How to use

The presented example is compiled in javascript, so you will need nodejs installed and npm.
To connect to the chat web site, you will need to additionally install the WS package, being in the same directory with the script:

npm i ws

User Id

Unfortunately, I couldn’t find an easy way to extract the user_id that is required to connect to the desired chat.
All my attempts to do this via fetch returns an error with the code 403 (Forbidden).
Therefore, this will have to be done manually. Substitute the name of the channel in
https://vh.live/api/v2/profile /{channelname}
And follow the educated link.
The first line under data -> id is the same user_id.

Script

In addition to the usual text messages from users, events about subscriptions / unsubscriptions, donations (only the amount, without currency), as well as the number of current viewers come at a certain interval.

Page on GitHub


If this material is useful to you and you have the opportunity,
then support the author and the site with a small tip:
https://hipolink.me/mikulski/tips
Thanks💛


0 comments
Inline Feedbacks
View all comments