:exclamation: This project is not maintained anymore. I haven't been using it myself since 2018 and thus can't test issues or fixes myself. If you want to take over the project, I'll gladly transfer it to you. Hit me up by email! |
---|
Transforms a YouTube playlist or a user's uploads into a Podcast.
This Python application can be used to subscribe to a YouTube channel or a playlist using a podcast client.
You will need the following, if you want to use this application:
To use the application, you will have to install it using pip
either into a virtualenv or globally. The instructions below are for installing into a virtualenv.
To set up a virtualenv with the necessary requirements, run th following commands:
$ python3 -m venv venv
$ . venv/bin/activate
$ pip install git+https://github.com/Feuermurmel/youtube-podcast-gateway.git
[...]
Successfully installed google-api-python-client-1.6.4 httplib2-0.10.3 isodate-0.5.4 oauth2client-4.1.2 pyasn1-0.3.6 pyasn1-modules-0.1.4 pytz-2017.2 rsa-3.4.2 six-1.11.0 uritemplate-3.0.0 youtube-dl-2017.9.24 youtube-podcast-gateway-0.1
If the last two lines look like the example above, the setup was successful.
Next, you will need to create a client_secrets.json
file containing your API key, which is used to access the YouTube API. You will need a Google account for this.
Go to the (Google Developer Console)[https://console.developers.google.com] and create a new project. Under APIs & Auth > APIs, enable the YouTube Data API v3 for the new project. Then, under APIs & Auth > Consent screen, choose an Email address [1] and set a Product name [2].
Then, go to APIs & Auth > Credentials and create an OAuth 2.0 Client ID. For the Application type, choose Installed application and for Installed application type, choose Other. After creating the key, click Download JSON. This will download a JSON file. Rename the file to client_secrets.json
and put it in the root directory of the application.
Now you can run the application for the first time using youtube-podcast-gateway
. It should ask you to visit an web site.
$ youtube-podcast-gateway
Go to the following link in your browser:
https://accounts.google.com/[...]
Enter verification code:
Navigate to the displayed URL. It should give you the option to log in and ask you whether you want to allow the application read access to your youtube account. You will need allow this [3]. You can of course use the same Google account for logging into the Developer Console as well as YouTube.
After accepting, the page will give you the verification code as string, which you can paste back into the console where the URL was displayed. Then it should say that authentication was successful and the the HTTP server is started:
Enter verification code: [...]
Authentication successful.
Starting server on port 8080 ...
From now on, the application will use the saved access token when it is started.
[1]: God knows why …
[2]: The name of the project as well as the product name are not important, you will only see the product name when authorizing the application to access your account.
[3]: The main benefit is that this way, you can subscribe to private playlists you created [4].
[4]: Or e.g. the "Watch Later" playlist, which also private.
To subscribe to a YouTube channel or playlist, URLs of the following form have to be assembled:
http://localhost:8080/uploads/<channel-id>
http://localhost:8080/playlist/<playlist-id>
In both cases, the assembled URI (possibly with localhost
replaced by the host name of your server) can be used in a podcast client to subscribe to the channel or playlist [5].
[5]: I've successfully tested iTunes, Apple's Podcasts app for iOS and Downcast for iOS. Please open an issue if you have trouble with your podcast client.
<channel-id>
is either the use name of the channel's owner or the channel ID. YouTube currently uses both to refer to channels, depending on context. For example:
https://www.youtube.com/channel/UCOGeU-1Fig3rrDjhm9Zs_wg
https://www.youtube.com/user/CGPGrey
Here, UCOGeU-1Fig3rrDjhm9Zs_wg
is the channel ID of a channel and CGPGrey
is the username of another channel. Either can be used in place of <channel-id>