In commemoration of YouTube strangely banning my account this morning after I already stopped using their service, I'm releasing the script that streams Dlive to youtube whenever the DLive channel goes live: https://github.com/ursadelta/andmultiply
What does the script do?
It livestreams the DLive livestreams to YouTube. The script refreshes the DLive page every 15 seconds to see if it's live, then begins livestreaming what it finds. It uses the title of the livestream plus a timestamp as the title for YouTube, truncated to the 100 character YouTube title limit.
Requirements to use:
1) Bash shell, usually meaning a linux operating system. If you don't have this, you can download virtualbox and install ubuntu or linux mint as a virtual machine running inside your OS.
Bash is supposedly available on Windows 10. I dont know how that works. With windows, you'll also have to find out how to install python, then the python pip package manager so that the calls to ffmpeg and youtube-dl work.
2) Access to the YouTube API.
I signed up for this so long ago I don't exactly remember how it's done. You're probably going to have to do a lot of search engine queries. If you get stuck, post here with a description of where you're at and I'll try to help out. If you get it working, please post a summary of the steps you took to get to that point.
3) Install ffmpeg. If using Debian/Ubuntu/Linux Mint, open a terminal (ctrl+alt+t) and enter:
$ sudo apt-get install ffmpeg -y
(The $ at the beginning of the line just indicates that this is code / a command. No need to put the "$ " in the actual command.)
It's also available in python pip.
$ pip install ffmpeg
4)Install youtube-dl. On debian/ubuntu/linux mint
$ sudo apt-get install youtube-dl
Youtube-dl is also available as a python pip package.
$ pip install youtube-dl
Open dliveToYoutube.sh in a text editor and insert the the values that you got from Youtube's developer API into apiKey, client_id, client_secret, and refresh_token .
In the terminal, make the .sh script executable:
$ chmod +x dliveToYoutube.sh
You can execute the script with
You can stop the script by pressing ctrl+c . If ffmpeg is still running, stop it with
$ kill -9 `pgrep -f ffmpeg`
To keep the script running even after the terminal is closed, run it instead with
$ nohup ./dliveToYoutube.sh &
You can then stop the script with
$ kill -9 `pgrep -f dliveToYoutube.sh`
And check for any running ffmpeg processes to close:
$ kill -9 `pgrep -f ffmpeg`
This is a script I made for fun. I cleaned it up just now and removed some things and I haven't tested it since I last had it working. It is inefficient and starts like 2 minutes after the stream begins. It could probably get down to a minute or less if done properly. It uses hardcoded sleep timers when building the stream instead of more properly checking the stream status and updating accordingly, which would reduce the time it takes to go live. If you want to fix that, great, please do so and add a pull request.