Making podcast feed out of youtube channel or playlist
For about a year now i'm a big fan of podcasts. Aspecially, when i switched my job and started to bike to the office and back. It's really handy and interesting to listen all kinds of news and discussions about programming, gadgets and IT news, console games etc. One of this podcasts was made by Keddr guys , who are based in Kiev. They are doing a lot of cool video reviews about gadgets and i like to listen them in general - they are fun and make nice content. But, unfortunately, at some point they freeze their podcasting channel moved back to Youtube, where they are publishing now their new program Vlog 2.0 . The problem is that podcast apps can't get content from Youtube for several reasons. . (Currently i'm using Cast and very happy about this app). So, for some time i got "cut" from their channel, because it's not handy for me to watch them on Youtube. I like to listen while riding a bike or walking. That's why i came to idea to write some application that could use Youtube API and make a proper feed for my podcast app. Enthusiasm is nice, but lack of experience of writing such kind of applications made me to think about browsing Github for similar solutions. And i think it was a good idea (that saved me a lot of time and nerves:) ) - there are a lot of applications that can solve this kind of problem. Eventually i stopped on youtube-podcast-gateway . It's quite easy to setup and the reason why i chose this application is that it allows to subscribe to both youtube channel and specific playlist. That was important for me, because i wanted to receive only updates from specific playlist.
So, here's how can you set it up for yourself :
You need a server where this application will run. This application needs to be accessible from Internet, if you want for your podcast app to be able to connect to this feed from anywhere. ( You can also make it run locally and just update your feeds when you're close to your pc). I choose Digital Ocean for their nice price and easiness in setting things up.
After creating a "Droplet", you need to ssh to it as root and install git and python virtual environment. I took Ubuntu image, so i had to do next :
apt-get install git
Installing python virtualenv. For that we need to install
pip first and only then
wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python easy_install pip pip install virtualenv pip install virtualenvwrapper
- Let's get code to our server from
cd /home git clone https://github.com/Feuermurmel/youtube-podcast-gateway.github
Before starting application we need to get
Youtube API key, that will allow us to access data from Youtube. For that we need to :
Go to Code Console
Login with your gmail account (if you don't have one, then you'll have to create one)
Create new project
APIs & authand enable access to Youtube API
Credentialssection and add new
OAuth 2.0 client ID- select
Otherapplication type and save it
Click on newly created API key and then click
Save this json file on your server in the root folder of youtube gateway application as
Now we have our API key and we can start setting up our application and finally get our podcast feed.
First we create
settings.sh file where we need to specify
After that we are setting environement for our server
./setup-venv.sh Running virtualenv with interpreter /opt/local/bin/python3.4 Using base prefix '/opt/local/Library/Frameworks/Python.framework/Versions/3.4' New python executable in venv/bin/python3.4 Also creating executable in venv/bin/python Installing setuptools, pip...done. [...] Successfully installed google-api-python-client isodate pytz youtube-dl httplib2 oauth2client six uritemplate pyasn1 pyasn1-modules rsa simplejson Cleaning up...
If it complains about some missing files - ignore it.
- Let's run the webserver itself .
Note: first time it will ask you to visit Google console auth website where you'll be ask whether you give permissions to access youtube data. Grant access and then paste the code in the command line. After that application will use your token from the cache.
./run.sh Go to the following link in your browser: https://accounts.google.com/[...] Enter verification code:
After pasting the code you should see something like this :
Enter verification code: [...] Authentication successful. Starting server on port 8080 ...
Now you are ready to subscribe to your favorite youtube channel or playlist. Just paste this URL to your podcast app and it should find it :
Localhost have to be replaced with the ip address of your VM and playlist-id can be found from youtube URL of the playlist :
Note: At first i was just running the server with
./run.sh & command, but that only worked when i had open remote session to my DigitalOcean droplet. To make it work without active remote connection i had to do next :
screen -d -m ./run.sh
For more tuning and details you can look at the project Github page
That's it. If you did everything right, then you should be able to start downloading latest episodes. The downside of it is that it's a video podcast and therefore it can take a lot of space on your phone. But that doesn't bother me - now i can still listen to another good podcast.