An automated, headless YouTube Uploader

Authors: Christian C., Moritz M., Luca S.

This project aims to automate the upload process for YouTube Videos. Since videos can only be publicly uploaded through the YouTube Data API by using a Google Workspaces Account (not free!), we decided to create a headless uploader using Selenium and Docker. This approach also bypasses API restrictions (e.g. Rate Limits/Endcards can't be set through the API).

Note: Because the upload process is often updated by Google, the code might not work when you try it! Often, there are only minor changes that have to be made. If you find yourself in this situation, please open an Issue or provide a quick fix in form of a Pull Request to make sure that the codebase stays up to date!

This project is for educational purposes only. Automating video uploads to YouTube with automation software might be against YouTube's Terms of Service. Even though our tests went smoothly, one might encounter problems when using the YouTube Uploader extensively.


Dockerized Browser

To run the uploader in a headless mode, it needs to connect to a docker container. To test the uploader locally without using docker, this section can be skipped. Otherwise, the docker container can be started by executing the following steps:

  1. Install docker and docker-compose

Note: On Windows and Mac, docker-compose is already installed when installing docker.

  1. Clone/Download this repository
  2. Navigate to the root of the repository
  3. Run docker-compose up to start the docker container (append -d if you want to run it in a detached mode)

Note: Selenium can now connect to the browser via port 4444. In Python the connection can be established with the following command.

driver = webdriver.Remote(

See for more information.

  1. Continue with the YouTube Uploader Setup

YouTube Uploader

This project requires Poetry to install the required dependencies.
Check out this link to install Poetry on your operating system.

Make sure you have installed Python 3.8! Otherwise Step 3 will let you know that you have no compatible Python version installed.

  1. Clone/Download this repository
  2. Navigate to the root of the repository
  3. Run poetry install to create a virtual environment with Poetry
  4. In a browser of your choice, login into the YouTube account that you want to use the uploader with
  5. Use a cookie extraction tool to extract the YouTube cookies into a JSON file (for example EditThisCookie [Chrome] or Cookie Quick Manager [Firefox])

Note: This is required so that the uploader is automatically logged in into the YouTube account using the cookies. Performing a Google login through automated software is extremely hard due to Google's bot detection/Login safety features

  1. Either run the dockerized Browser with docker-compose up, install geckodriver for a local Firefox or ChromeDriver for Chromium. Ensure that geckodriver/ChromeDriver are in a location in your $PATH.
  2. Run poetry run python to run the program. Alternatively you can run poetry shell followed by python By default this connects to the dockerized Firefox Browser (headless). To automate a different Browser (not-headless) use the --browser [chrome/firefox] command line option.

Note: When using Docker, the video that should be uploaded needs to be in the repository's uploads folder. This is because REPOSITORY_ROOT/uploads/ is mounted to /uploads/ in the Docker container. Therefore, the video_path argument has to be passed in the following format: /uploads/

Run Parameters

You can also get these definitions by running --help

usage: [-h] [-B {docker,chrome,firefox}] -l LOGIN_COOKIES [--thumbnail-path THUMBNAIL] -t TITLE -d DESCRIPTION [-g GAME] [-k KIDS] [-ut UPLOAD_TIME] video_path

positional arguments:
  video_path            Path to the video file. When using docker, this path has to be inside the container (default mount is /uploads/).

optional arguments:
  -h, --help            show this help message and exit
  -B {docker,chrome,firefox}, --browser {docker,chrome,firefox}
                        Select the driver/browser to use for executing the script (default: docker).
  -l LOGIN_COOKIES, --login-cookies-path LOGIN_COOKIES
                        A json file that contains the cookies required to sign into YouTube in the target browser.
  --thumbnail-path THUMBNAIL, -T THUMBNAIL
                        Path to the thumbnail file (default: None).
  -t TITLE, --title TITLE
                        This argument declares the title of the uploaded video.
                        This argument declares the description of the uploaded video.
  -g GAME, --game GAME  This argument declares the game of the uploaded video (default: None).
  -k KIDS, --kids KIDS  Whether the video is made for kids or not. (default: False)
  -ut UPLOAD_TIME, --upload_time UPLOAD_TIME
                        This argument declares the scheduled upload time (UTC) of the uploaded video. (Example: 2021-04-04T20:00:00)