Want to take YouTube2­Audiobook for a spin without installing it? Then our new Docker container has all you need. Readily available on both GitHub and Docker Hub.

YouTube2­Audiobook for Everyone!

Over the past years, YouTube2­Audiobook has allowed me to fill, what would otherwise be dead or lost time, with sort-of "speed-reading" through My Reading List.

However, the reality is also that the app does have some non-trivial dependencies which need to be present. Get them wrong and nothing will work. Even worse, installing the dependencies is OS dependent and left entirely to the user.

Now, not everyone can or is willing to install all the required dependencies on their machine in order to get the app running. And that's absolutely understandable.

Nonetheless, we want YouTube2­Audiobook to be as accessible as can be. So that everyone can tap into the vast knowledge available on YouTube and listen to YouTube on the go.

Fortunately, there is a readily available solution which is able to solve these problems: containers!

A Docker Container for Everyone!

We are proud to announce that YouTube2­Audiobook is now available as a Docker container. Both on GitHub and Docker Hub.

Building from Source

Building your own YouTube2­Audiobook Docker image is as simple as downloading the latest release from the GitHub repository, unpacking the archive, and executing

docker build -t dumrauf/yt2ab:<tag> .

Here, <tag> refers to the tag given to the resulting Docker image. It should match the version number of the release you downloaded. Not only does this promote consistency but it's also what the remainder of this article assumes.

With version v1.3.0 being the latest release, as of writing this article on 2020-10-18, the above translates into

docker build -t dumrauf/yt2ab:v1.3.0 .

Leveraging Docker Hub

It's even easier to leverage the free Docker image provided on Docker Hub. You can pull down the Docker image for version 1.3.0 of the app by just typing in

docker pull dumrauf/yt2ab:v1.3.0

Even though there is a latest tag, we discourage its use in production environments as it may have unintended side effects. If you know what you are doing, feel free to go ahead, as it can provide value feedback. If you find any problems, please file a GitHub issue, so we can improve things for everyone.

Using the Container

Whether you've built your own Docker container or downloaded it from Docker Hub, using it is straightforward.

Getting Started

Running the Docker container is very similar to running the original Bash script. All input parameters are still the same. The only new parameter is specific to Docker.

By default, the Docker container stores all downloaded audiobooks in /data.

Note that this mount is inside the container. In order to store the audiobooks outside the container, simply pass a mapping of /data to a volume of your choice at startup.

Downloading and converting a given <YouTube-URL> into an audiobook in the current directory, when using version 1.3.0 of the app, is as simple as

docker run -v "$(pwd)":/data dumrauf/yt2ab:v1.3.0 -u <YouTube-URL>

So, in order to download and convert the entire "Genre: Science" playlist from the great LibriVox Audiobooks channel, the following is sufficient

docker run -v "$(pwd)":/data dumrauf/yt2ab:v1.3.0 -u "https://youtu.be/gmmgWcbAmjo?list=PLZ-bKJtH3G7BYYscYohAFZAq65RwCf-K-"

One command. All videos as audiobooks. In the current directory. Simple.

Advanced Use

Historically, Docker used to run every container as the root user. And it still does — unless told otherwise.

This behaviour is most obvious when downloaded audiobooks end up belonging to the root user and might not even be accessible, let alone removable, by the current user.

This nuisance (and more to the point — blatant security risk) can be avoided by running the Docker container as the current user and group, leveraging the corresponding optional parameters.

Downloading and converting a given <YouTube-URL> into an audiobook in the current directory, when using version 1.3.0 of the app, becomes

docker run -v "$(pwd)":/data -u $(id -u ${USER}):$(id -g ${USER}) dumrauf/yt2ab:v1.3.0 -u <YouTube-URL>

Downloading the example playlist above then becomes

docker run -v "$(pwd)":/data -u $(id -u ${USER}):$(id -g ${USER}) dumrauf/yt2ab:v1.3.0 -u "https://youtu.be/gmmgWcbAmjo?list=PLZ-bKJtH3G7BYYscYohAFZAq65RwCf-K-"

One command. All videos as audiobooks. In the current directory. Owned by the current user. Simple.

So, How do You Containerise Apps?!

While the above Worx for Me!™ when it comes to containerising the YouTube2­Audiobook app, you may have an alternative or better way.

Feel free to leave a comment or contribute to the GitHub repository, so we can make things better for everyone! A big thank you to everyone who did already contribute!
Think this is all rubbish, incomplete, massively overcomplicated, or simply the wrong tool for the job?! Send me an email at dominic AT how-hard-can-it.be and teach me something new!

As always, prove me wrong and I'll buy you a pint!