Closed just-rich closed 2 years ago
It creates the stream from an HTML video element, You only need to show the live feed on the video element.
BTW you can use a direct video link, not just youtube.
BTW you can use a direct video link, not just youtube.
Oh that's good to know.
Well I couldn't download youtube_dl because there wasn't one, but there was a youtube-dl.
First time I ran play command it said it downloaded, with no errors. But when I ran *p command it never played, and no logs in console. When I tried again I ran into these errors below, the first one is pretty self explanatory.
So I'm not sure if it's youtube-dl I'm having an issue with, or the headless browser selenium chrome. I have another bot on my raspberry pi that uses chromdriver, but had to modify the code to execute from a path that does work, like this;
browser = await pyppeteer.launch({'executablePath':'/usr/bin/chromium-browser'})
Let me know if you have any suggestions
youtube_dl
and youtube-dl
are the same, If you use pip install youtube-dl
or pip install youtube_dl
It will download the same module.
The errors are related to youtube-dl, Are you able to use it in the terminal youtube-dl 'url'
?
But isn't pip for python? I used npm install youtube-dl
Ok I tested it in terminal and i found the issue! USER ERROR lol
I was trying to play a youtube link from /short/
Where do these videos download at? The one I should did using youtube-dl <url>
where does it go?
And where do the videos go when using the bot?
(i'm using a raspberry pi with limited storage, so would like to purge these once in a while)
I will check other methods for playing youtube videos without a full download, When using youtube-dl you can pass the destination directory, The bot saves videos in ./client/tmp
directory. It also does a full purge before downloading a new video.
oh ok so it only keeps 1 video at a time then, thats good.
Now about this headless browser or whatever issue..
When I run *play url
it downloads fine.
but when I run `p it doesn't join the voice channel, so can't tell if it would even play or not.
like I mentioned before, on my raspberry pi I use chromium for something and have to specify the path it use
browser = await pyppeteer.launch({'executablePath':'/usr/bin/chromium-browser'})
any suggestions on what I should do to fix this?
thank you for all the help so far!
This project uses selenium
instead of pyppeteer
, When using *p
does it show any error on terminal?
No error in terminal, just "play".
What is the environment? I had issues with other versions but the only environment that worked for me was ubuntu, chrome 88 and nodejs 14.
Not sure what you mean by environments- if you haven't noticed already I'm not that savvy with all of this. (only own raspberry pi to host all my servers bots on, only good at editing configs and looking up errors with 50% chance of fixing them lol)
but hope this helps;
Raspbian GNU/Linux 10 (buster)
node version v16.13.0
npm version 8.1.0
Selenium version 4.1.2 (python -c "import selenium; print(selenium.__version__)"
)
ChromeDriver 92.0.4515.98
im thinking I have to specify the path for selenium and chrome?
Currently, I can only guarantee the above environment, If chrome and chromedriver are in /bin
directory the module will find it, You don't need to specify the path.
well i think that was the issue last, the one in /bin doesnt work but the one in /usr/bin does- i'm almost positive this was he issue I was having with another bot and reason why I had to use path.
these are what tell it to use the chromedriver right?
const webdriver = require('selenium-webdriver') const chrome = require('selenium-webdriver/chrome')
how can I tell it to use the chromedriver in /usr/bin instead?? like I did with the pyppeteer function with the other bot?
THANKS!
edit:
are you on discord? if you want to add me that would be great, and faster communication. i'll also be afk for a while, 2am over here. rich#0003
I left discord for a while, Make sure to use a user token instead of a bot token since it's a self-bot. I believe you can find the selenium documentation, If it doesn't throw an error it means it has created the selenium socket.
Yeah I'm using a user token. I had to change the ClientDataManager.js file because version 11 doesn't support stage channels, and you can't use a user token with version 12. might be something you want to mention in the readme, adding if(channel != null) guild.channels.set(channel.id, channel);
fixes it- you prob already know that but I had no clue.
well i guess ill have one of the devs in my server see if they can get it working.
thanks
Before I never let the bot run for more than a few minutes after running the *play
command after using *p url
to download video, just thought it wasn't doing anything.
but i left it running and finally got an error. `/home/pi/discordbots/videostream/node_modules/selenium-webdriver/lib/error.js:517 let err = new ctor(data.message) ^
WebDriverError: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
(Session info: headless chrome=92.0.4515.98)
at Object.throwDecodedError (/home/pi/discordbots/videostream/node_modules/selenium-webdriver/lib/error.js:517:15)
at parseHttpResponse (/home/pi/discordbots/videostream/node_modules/selenium-webdriver/lib/http.js:642:13)
at Executor.execute (/home/pi/discordbots/videostream/node_modules/selenium-webdriver/lib/http.js:568:28)
at runMicrotasks (
I'm not sure about the cause of the error, But I would recommend the suggested environment.
If you are still not able to set up the bot, I have pushed a Dockerfile
I've never used Docker before but will look into it, thanks.
been wanting to get a bot like this streaming a live video stream 24/7- i got it almost running last night after some messing around. sudo mount -o remount,size=8G /dev/shm
used this and stopped running other functions using chrome and was able to get it to join and screenshare but just never got it to play youtube.
then i learned I can't play youtube on regular chromium browser on the raspberry so was going to look into how others are able to do it.
but will look into this docker, thanks again
Got it all working, but after using *p url
and downloading then running *p
to play nothing happened, a while later error was sent to console
throw er; // Unhandled 'error' event
^
Error: WebSocket was closed before the connection was established
at WebSocket.close (/Discord-Screenshare/node_modules/ws/lib/websocket.js:285:14)
at WebSocketShard.destroy (/Discord-Screenshare/node_modules/discord.js-selfbot-v13/src/client/websocket/WebSocketShard.js:817:27)
at WebSocketShard.onClose (/Discord-Screenshare/node_modules/discord.js-selfbot-v13/src/client/websocket/WebSocketShard.js:370:12)
at WebSocket.onClose (/Discord-Screenshare/node_modules/ws/lib/event-target.js:210:18)
at WebSocket.emit (node:events:527:28)
at WebSocket.emitClose (/Discord-Screenshare/node_modules/ws/lib/websocket.js:258:10)
at TLSSocket.socketOnClose (/Discord-Screenshare/node_modules/ws/lib/websocket.js:1249:15)
at TLSSocket.emit (node:events:539:35)
at node:net:715:12
at TCP.done (node:_tls_wrap:582:7)
Emitted 'error' event on WebSocket instance at:
at emitErrorAndClose (/Discord-Screenshare/node_modules/ws/lib/websocket.js:993:13)
at processTicksAndRejections (node:internal/process/task_queues:83:21)```
The discord module had an issue with the user WebSocket connection.
How could I make it so it could play videos not on youtube? preferably a live stream feed