Play youtube videos from the chat box on StumbleChat
The StumbleTube is a UserScript written in JavaScript designed to enhance the user experience on StumbleChat, a web-based chat platform. It enables users to play YouTube videos directly from the chat box by processing specific commands and converting various YouTube URL formats into a standardized format for playback.
The script modifies the behavior of WebSocket communication to intercept and manipulate messages. It establishes a WebSocket connection with the chat server and overrides the send
method to intercept outgoing messages, allowing for dynamic responses and actions based on user input.
.youtube
, .video
, .play
, or .yt
.youtu.be
, youtube.com/watch?v=
) into a standardized format for seamless playback.send
method to attach a custom message handler. This ensures that all incoming messages are processed for YouTube-related commands..youtube
, .yt
). If a match is found, the script extracts the query or URL from the message.https://www.youtube.com/watch?v=
format.Here are the supported commands for playing YouTube videos:
.youtube [query or URL]
: Play a YouTube video. Example: .youtube https://www.youtube.com/watch?v=dQw4w9WgXcQ
.video [query or URL]
: Play a YouTube video. Example: .video dQw4w9WgXcQ
.play [query or URL]
: Play a YouTube video. Example: .play https://youtu.be/dQw4w9WgXcQ
.yt [query or URL]
: Play a YouTube video. Example: .yt rick roll
The script is available on GreasyFork:
Install StumbleTube