Let’s agree on one thing: Creating high-quality videos that captivate your audience, rack up likes, and boost your reach takes up a lot of valuable time—even more so if you don’t use artificial intelligence in the process. And especially if you regularly upload a lot of clips, a little helper in the form of a script—or, if you want to scale it up, a Docker container—can’t hurt. No AI, just code and an authorization token that lets this mini-app authenticate with YouTube.
That’s exactly the tool we’ll build in this tutorial. The principle is simple: You place a finished video in a predefined folder, and shortly afterward, you’ll find it as a private video on your YouTube channel. You can then put the finishing touches—including the description, thumbnail, and publication—in YouTube Studio as usual. The script pulls the title directly from the file name.
A quick warning up front: The most time-consuming part isn’t the script itself, but the one-time setup with Google. After that, however, your uploader can run largely on its own as long as your computer or NAS is running and the connection to YouTube is working.
How the YouTube Uploader Works
Before you get started, it’s worth taking a quick look under the hood. Ultimately, our uploader is just a small Python script that runs on your computer—or later, perhaps on your NAS or server—and checks a specific folder every 30 seconds. If it finds a new video there, the following happens:
- The uploader waits until the file size and modification date haven’t changed for two minutes. This reduces the risk of the upload starting while the file is still being copied into the folder.
- After that, the tool logs into YouTube using the permissions you previously granted and uploads the video in 16 MB chunks. If the connection is lost or a temporary server error occurs, the script attempts to resume the upload. It waits progressively longer between failed attempts.
- The script uses the file name as the title. So “UIIA Cat Remix.mp4” becomes the video “UIIA Cat Remix.”
- Once the upload is successfully completed, the uploader moves the original file to the “uploaded” folder. If YouTube immediately rejects the upload request due to certain invalid details, the file is moved to the “failed” folder instead. You can find the reason in the log. However, you’ll need to check YouTube Studio for errors that occur only during subsequent video processing.
The tool is intentionally kept as simple as possible and therefore cannot do certain things: set descriptions and tags, upload thumbnails, populate playlists, or notify you via email. Less code means fewer sources of error. If you’d like to use additional features later, you can, of course, customize the code (or have it customized) to suit your needs.
Here’s what you’ll need for your YouTube uploader
- A computer running Windows 10 or 11. You’ll set up the uploader on this computer and sign in to Google once. Windows 10 still works technically, but as of October 2025, it will only receive security updates under certain conditions.
- The Google Account you use to manage your YouTube channel.
- A stable internet connection. After all, video files are often several gigabytes in size.
- Optionally, a NAS with Docker support—such as a compatible Synology DiskStation with Container Manager—if you want the uploader to run around the clock.
It’s best to enable the display of file extensions in Windows Explorer right from the start. To do this, click “View” in the menu bar, then “Show,” and check the box next to “File name extensions.” In Windows 10, you’ll find this option directly in the “View” tab. This way, you can see at a glance whether a file is actually named uploader.py and not accidentally uploader.py.txt. Python wouldn’t know what to do with the latter.
Step 1: Set up Google Cloud—the key to your channel
In order for an application to upload videos on your behalf, Google requires you to create your own project in the Google Cloud Console. While this may sound like a lot of work at first, it’s actually quite manageable for our purposes. For the API functions described here, you typically don’t need a paid Google Cloud trial or a credit card. For all the following steps, sign in with the Google Account you use to manage your YouTube channel.
Create a New Project
Go to the Google Cloud Console. If this is your first time visiting the site, you may first need to accept the Terms of Service. Then, click the project selector next to the Google Cloud logo at the top and select “New Project” in the drop-down menu. Enter a name, such as “youtube-uploader,” leave the location set to “No organization” unless you’re using a Google Workspace business account, and confirm by clicking “Create.”
After a few seconds, your project will be ready. Make sure it’s actually selected in the project selection at the top before you continue. To do this, click the “Select project” button again and then choose the project you just created from the list. Otherwise, your settings might end up in the wrong project.
Enable the YouTube Data API v3
Now open the “APIs and Services” section via the menu in the top-left corner, and then select “Library.” Type “YouTube Data API v3” into the search field, select the result with the same name, and click “Enable.” That’s all the APIs we need for our uploader.
Set Up Google Auth Platform
Now we’ll move on to the so-called OAuth consent screen. This is the window where you’ll later authorize our uploader to upload videos to your channel. For this, we use OAuth instead of a standard API key. An API key alone isn’t sufficient to upload videos on your behalf. Stay on this exact page and open the “Google Auth Platform” section via the left-hand menu. Then click on “Branding.” If a message appears stating that the Google Auth Platform hasn’t been configured yet, click on “Get Started.” A short wizard will guide you through four sections:
- Under “Application Information,” enter a name for your app—for example, “YouTube Uploader”—and select your email address as the support address. Click “Next.”
- Under “Target Audience,” select “External” and click “Next” again. The “Internal” option is intended only for Google Workspace organizations.
- Under “Contact Information,” enter your email address again. Google will send you important information about your project to this address.
- Finally, accept the User Data Policy for Google API Services, click “Next,” and then click “Create.”
Set Up Permissions for Video Uploads
To allow our script to upload videos later, it needs the appropriate permission. In the Google Auth Platform, open the “Data Access” section and click “Add or remove permissions.” Search for the following permission:
https://www.googleapis.com/auth/youtube.upload
If it doesn’t appear in the list, you can enter it using the field for manually adding permissions. Confirm your selection by clicking “Refresh” and save the changes using the Save button.
Now, our uploader will only have permission to upload videos. It won’t be able to delete your existing videos or access other Google services.
Test Mode or Production Mode—the choice is yours
Now we come to a point that Google has, unfortunately, made a bit more complicated than is actually necessary for our small script. New external OAuth applications are initially in “Test” status. You can already use our uploader in this state, but with one limitation: The refresh tokens issued for our YouTube access expire after one week.
While this doesn’t mean you have to create a new Google project every week, you do need to reconfirm your authorization. Our script takes care of the rest. If, on the other hand, you want to run the uploader permanently and, if possible, without interruptions, you’ll need a so-called OAuth application in production mode. However, Google now requires additional information for this, which seems a bit excessive—especially for a purely private project. But it’s best to decide for yourself.
Option A: Use the uploader in test mode
This option is the easiest way and probably the ideal solution if you first want to try out whether the uploader fits into your workflow at all. Under “Google Auth Platform,” open the “Audience” section. The publication status there should already be set to “Test.” You don’t need to change anything there at this time.
Further down, you’ll find the “Test Users” section. Click “Add users” there and enter the email address of your Google account. Use the account you use to manage your YouTube channel, and save the change. You may receive an error message if you don’t confirm the entered email address by pressing the Enter key before clicking the Save button. However, you can ignore this message.
That’s all there is to it. You can use our uploader with this Google account without having to run a website or create a privacy policy.
There is one catch, though: The authorization expires after 7 days. After that, you’ll need to reconnect our script to Google. On Windows, you can do this later by entering the following command in the console (in the correct tool directory):
python uploader.py login
This will open your browser; confirm the Google authorization, and the uploader will save a new token. The process usually takes only a few moments. Of course, your previously uploaded videos remain unaffected. However, fully automatic renewal after this period expires isn’t possible, since Google requires new authorization. If you’re running the uploader on a NAS and, for example, go on a trip for several weeks, the tool won’t be able to upload any more videos once the authorization expires until you log in again—and that’s where Option B comes in.
Option B: Run the uploader in production mode permanently
If you want to avoid having to log in every week, you can switch your OAuth application to production mode. Until recently, this was relatively simple. However, Google now requires additional information regarding “branding” for new external applications. This includes, for example, a publicly accessible homepage and an appropriate privacy policy.
Yes, you read that correctly: Even though you just want to use a small Python script for your own YouTube channel, Google may require a publicly accessible website for production mode. This has little to do with the actual functionality of our uploader, but without this information, the application cannot currently be published in the current Google interface.
If you already have your own website, you can simply create a small information page there for your uploader. This page should describe what your application does and link to an appropriate privacy policy. In this policy, you should primarily explain that the application uses the YouTube Data API to upload videos to the authorized channel, stores the necessary OAuth credentials locally, and does not transfer any additional user data to its own cloud service—provided this corresponds to your actual implementation. You must also consider the data processing involved in the publicly accessible information page itself.
Unfortunately, it is not possible to derive a universally legally compliant privacy policy for all readers from this, so this point is left to your own discretion. What additional information is required depends, among other things, on whether you’re using the application for personal or business purposes and how your website is operated. Next, open the “Branding” section in the Google Auth Platform and enter the URLs for your homepage and privacy policy there. The domain you use must belong to you and, if necessary, be verified via Google Search Console.
Once all information is complete and saved, you can click “Publish App” under “Target Audience” to enable production mode. Don’t worry—despite the term “publish,” the app isn’t visible to others anywhere in the Play Store or on Google. Only users with the OAuth sign-in link can use the app.
Note: For an app that only you use, full OAuth app verification—which Google will likely suggest as the next step—is usually not required.
In production mode, the fixed seven-day restriction no longer applies. This usually allows our uploader to automatically renew its credentials on an ongoing basis without requiring you to log in to Google again every week. You’ll only need to log in again in exceptional cases, such as if you revoke access or haven’t used the refresh token for 6 months.
Create and Download Access Credentials
Regardless of which option you ultimately chose, we now need the actual access credentials for our uploader. In the Google Auth Platform menu, select “Clients” and click “Create Client.” Set the application type to “Desktop application,” enter any name you like—such as “Uploader PC”—and click “Create.”
A window will now appear displaying your client ID and client secret. Click “Download JSON” and save the corresponding configuration file. If you miss the download, first check whether you can download the file again via Client Management. If the required key is no longer available, you may need to generate a new one. The downloaded file is usually saved in your Downloads folder and has a somewhat unwieldy name like client_secret_123456789012-abc123.apps.googleusercontent.com.json.
Store this file in a secure location. It contains the credentials for the application you created, but does not yet grant permission to upload videos to your channel on its own. Our script only obtains this permission through the subsequent OAuth login. The `token.json` file generated later is therefore particularly sensitive, as it grants actual access to your channel.
Step 2: Install Python on Your Computer
Our uploader is written in the Python programming language. For Windows to run the script, you’ll need Python itself as well as two small extensions from Google. For Windows, the Python team now recommends the Python Install Manager. This small tool installs Python and handles updates to new versions as needed.
So either open the Microsoft Store, search for “Python Install Manager,” and install the corresponding entry from the Python Software Foundation. Alternatively, download the package from the download page at python.org (button: Download Python Install Manager). Then double-click the msix package and start the installation. Next, open the Terminal by right-clicking the Start button and selecting “Terminal.” In Windows 10, this option is often labeled “Windows PowerShell.” Type the following command there and press Enter to confirm:
py install default
The Install Manager will now download the latest version of Python and set it up. If it asks whether it should add a folder to the PATH variable, you can agree. This is not usually absolutely necessary for our project. Next, use the following command to check if everything is working:
python --version
If a line appears with a Python version number, everything worked. In the next step, we’ll create the uploader folder and set up the actual script.
Step 3: Prepare the Upload Folder
After installing Python, enter the following commands in the console (which should still be open) to create the project folder and set up your own virtual Python environment:
mkdir C:\YouTube-Uploader cd C:\YouTube-Uploader python -m venv .venv
Of course, you can adjust the path as you like—your uploads don’t have to (and shouldn’t) necessarily be located on your system drive. Once the commands have been executed, continue by installing the two necessary Google libraries in your project folder.
.\.venv\Scripts\python.exe -m pip install google-api-python-client google-auth-oauthlib
Next, copy the client_secret_…json file you downloaded earlier into the folder you just created. Also, create a file named uploader.py in the same folder. Open it with a text editor of your choice and paste the following content. Make sure the file is actually named uploader.py and not accidentally uploader.py.txt. In the Windows Editor, you’ll need to select the “All Files” file type when saving.
"""YouTube Uploader: Privately upload videos from 'input'.
Log in once: python uploader.py login
Start the uploader: python uploader.py
The current upload session is saved in state.json so that an upload
can continue even after a restart (as long as the session is valid).
"""
import json
import logging
import os
import random
import re
import shutil
import sys
import time
from pathlib import Path
from google.auth.exceptions import RefreshError
from google.auth.transport.requests import AuthorizedSession
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
# --- Settings -----------------------------------------------------------
VISIBILITY = "private" # private | unlisted | public
CHECK_ALL = 30 # seconds
DONE_AFTER = 120 # seconds without file changes
PAUSE_AFTER_ERROR = 600 # 10 minutes between extended attempts
SHORT_TRIALS = 6 # repetitions with exponential backoff
EXTENSIONS = {".mp4", ".mov", ".m4v", ".mkv", ".webm", ".avi"}
BLOCK_SIZE = 16 * 1024 * 1024 # 16 MiB, a multiple of 256 KiB
FOLDER = Path(__file__).resolve().parent
INPUT = FOLDER / "input"
UPLOADED = FOLDER / "uploaded"
FAILED = FOLDER / "failed"
TOKEN = FOLDER / "token.json"
STATE = FOLDER / "state.json"
SCOPES = ["https://www.googleapis.com/auth/youtube.upload"]
UPLOAD_URL = "https://www.googleapis.com/upload/youtube/v3/videos"
log = logging.getLogger("youtube-uploader")
class Rejected(Exception):
"""Permanent rejection by YouTube."""
class Temporary(Exception):
"""Temporary network, API, or quota issue."""
def save(path, data):
"""Write a JSON file so that a crash doesn't leave it half-finished."""
tmp = path.with_name(path.name + ".tmp")
tmp.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
os.replace(tmp, path)
def log_in():
files = sorted(FOLDER.glob("client_secret*.json"))
if not files:
log.error("client_secret*.json is missing from folder %s", FOLDER)
return
flow = InstalledAppFlow.from_client_secrets_file(str(files[0]), SCOPES)
access = flow.run_local_server(
port=0,
prompt="consent",
authorization_prompt_message="Please sign in via your browser: {url}",
success_message="Done! You can close this window.",
)
save(TOKEN, json.loads(access.to_json()))
log.info("Google sign-in saved. Starting uploader: python uploader.py")
def get_status():
if not STATUS.exists():
return {}
return json.loads(STATUS.read_text(encoding="utf-8"))
def identity(file):
info = file.stat()
return f"{file.name}|{info.st_size}|{info.st_mtime_ns}"
def file_ready(file, observed):
info = file.stat()
identifier = (info.st_size, info.st_mtime_ns)
previous = observed.get(file)
if not previous or previous[0] != identifier:
observed[file] = (identifier, time.monotonic())
return False
return info.st_size > 0 and time.monotonic() - previous[1] >= READY_AFTER
def check_error(response):
"""Classify API errors as temporary or permanent."""
code = response.status_code
try:
details = response.json().get("error", {})
reasons = [entry.get("reason", "") for entry in details.get("errors", [])]
description = str(details.get("message", ""))[:180]
except (ValueError, AttributeError, TypeError):
reasons, description = [], ""
reason = ", ".join(reasons) or description or "no details"
message = f"HTTP {code}: {reason}"
# Limits are often reported as HTTP 403 instead of 429.
limits = {"quotaExceeded", "rateLimitExceeded", "userRateLimitExceeded",
"uploadLimitExceeded", "backendError"}
if code in (408, 409, 429, 500, 502, 503, 504) or limits.intersection(reasons):
raise Temporary(message)
if code == 401:
raise Temporary(message + "; if necessary, run 'python uploader.py login'")
raise Rejected(message)
def already_received(response):
"""A 308 status code with 'Range: bytes=0-123' means: 124 bytes available."""
range = response.headers.get("Range", "")
if not range:
return 0
match = re.fullmatch(r"bytes=0-(\d+)", range)
if not match:
raise Temporary("Unknown Range header from YouTube")
return int(match.group(1)) + 1
def upload(file, key, state):
"""Resume an existing upload session or start a new upload."""
access = Credentials.from_authorized_user_file(str(TOKEN), SCOPES)
client = AuthorizedSession(access)
size = file.stat().st_size
entry = status.get(key, {})
position = 0
if entry.get("completed_id"):
return entry["completed_id"]
if entry.get("url"):
# After an interruption or restart, ALWAYS check YouTube for progress first.
response = client.put(
entry["url"], data=b"", timeout=(20, 60), allow_redirects=False,
headers={"Content-Range": f"bytes */{size}"},
)
if response.status_code in (200, 201):
return response.json()["id"]
if response.status_code == 308:
position = already_received(response)
if position > size:
raise TemporaryError("YouTube reports invalid upload progress")
log.info("%s: Resuming at %d %%", file.name, position * 100 // size)
elif response.status_code in (404, 410):
log.warning("%s: Old upload session expired; restart.", file.name)
state.pop(key, None)
save(STATE, state)
entry = {}
else:
check_error(response)
if not entry.get("url"):
title = re.sub(r"[<>]", "", file.stem).strip()[:100] or "Video"
response = client.post(
UPLOAD_URL,
params={"part": "snippet,status", "uploadType": "resumable"},
json={"snippet": {"title": title},
"status": {"privacyStatus": VISIBILITY}},
headers={"X-Upload-Content-Length": str(size),
"X-Upload-Content-Type": "application/octet-stream"},
timeout=(20, 60),
)
if response.status_code not in (200, 201):
check_error(response)
url = response.headers.get("Location")
if not url:
raise TemporaryError("YouTube did not provide an upload URL")
state[key] = {"url": url}
save(STATE, state)
log.info("%s: Upload started (%.1f MB)", file.name, size / 1e6)
position = 0
url = state[key]["url"]
with file.open("rb") as video:
while position < size:
video.seek(position)
block = video.read(min(CHUNKS, size - position))
if not block:
raise TemporaryError("File changed during upload")
response = client.put(
url, data=block, timeout=(30, 300), allow_redirects=False,
headers={"Content-Range":
f"bytes {position}-{position + len(block) - 1}/{size}",
"Content-Type": "application/octet-stream"},
)
if response.status_code in (200, 201):
return response.json()["id"]
if response.status_code != 308:
check_error(response)
new = already_received(response)
if new <= position or new > size:
raise Temporary_Error("YouTube did not confirm the data chunk")
if new * 10 // size > position * 10 // size:
log.info("%s: %d %% uploaded", file.name, new * 100 // size)
position = new
raise Temporary("Upload completion confirmation is still pending")
def upload_with_retry(file, key, status):
for attempt in range(SHORT_ATTEMPTS + 1):
try:
return upload(file, key, status)
except (Rejected, RefreshError):
raise
except Exception as error:
# Also connection errors/timeouts: the next attempt first checks the status.
if attempt == SHORT_ATTEMPTS:
raise Temporary(str(error)) from error
pause = min(60, 2 ** (attempt + 1)) + random.uniform(0, 1)
log.warning("%s: %s. Next attempt in %.0f seconds.",
file.name, error, pause)
time.sleep(pause)
raise AssertionError("Unreachable")
def move(file, destination):
filename = destination / file.name
if filename.exists():
name = f"{file.stem}_{time.strftime('%Y%m%d_%H%M%S')}"
filename = destination / f"{name}{file.suffix}"
shutil.move(str(file), str(filename))
def process(file, status):
key = identity(file)
try:
info = status.get(key, {})
if info.get("rejected"):
move(file, FAILED)
else:
video_id = upload_with_retry(file, key, status)
# IMPORTANT: Save the success status before moving the file. A crash in between
# will prevent a second upload the next time the program starts.
status.setdefault(key, {})["completed_id"] = video_id
save(STATE, state)
move(file, UPLOADED)
log.info("%s: DONE! https://studio.youtube.com/video/%s/edit",
file.name, video_id)
except Rejected as error:
log.error("%s: YouTube rejects the request: %s", file.name, error)
state.setdefault(key, {})["rejected"] = True
save(STATE, state)
try:
move(file, FAILED)
except OSError as problem:
log.error("%s: Move failed: %s", file.name, problem)
return True
except Exception as error:
log.warning("%s: %s. Next attempt in %d minutes.",
file.name, error, PAUSE_AFTER_ERROR // 60)
return False
state.pop(key, None)
save(STATE, state)
return True
def monitor():
if VISIBILITY not in ("private", "unlisted", "public"):
log.error("VISIBILITY must be 'private', 'unlisted', or 'public'.")
return
if not TOKEN.exists():
log.error("token.json is missing. Log in first: python uploader.py login")
return
for path in (INPUT, UPLOADED, FAILED):
path.mkdir(exist_ok=True)
status = get_upload_status()
seen = {}
log.info("Uploader started: Monitoring %s every %d seconds", INPUT, CHECK_ALL)
while True:
try:
files = sorted(INPUT.iterdir())
for file in files:
if (not file.is_file() or file.name.startswith(".")
or file.suffix.lower() not in EXTENSIONS):
continue
if file_ready(file, seen):
if not process(file, state):
time.sleep(PAUSE_AFTER_ERROR)
break
seen = {p: x for p, x in seen.items() if p.exists()}
except OSError as error:
log.warning("Directory error: %s", error)
time.sleep(CHECK_ALL)
if __name__ == "__main__":
outputs = [logging.FileHandler(FOLDER / "uploader.log", encoding="utf-8")]
if sys.stderr:
outputs.append(logging.StreamHandler())
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(message)s",
datefmt="%d.%m.%Y %H:%M:%S", handlers=outputs)
try:
if sys.argv[1:] == ["login"]:
log in()
else:
monitor()
except KeyboardInterrupt:
log.info("Uploader terminated.")
This is the core of our tool. Next, start the one-time Google sign-in with the following command in the console:
.\.venv\Scripts\python.exe uploader.py login
Your browser should now open so you can grant access to your YouTube channel. After that, the `token.json` file will be generated. If necessary, you’ll need to trust the login, show the advanced options, and then confirm by clicking “Open YouTube Uploader (unsafe)” and clicking the “Next” button again. You can now close the browser window; the `token.json` file is ready in the folder.
Important: Never share this file with anyone. Unlike the original client_secret file, it actually contains authorization for your YouTube channel, meaning anyone could upload videos to your account (albeit only as private or drafts).
Signing In and Uploading Your First Video to YouTube
Don’t be intimidated by the many lines of code. You don’t need to understand every function to use our uploader. However, for those who are curious, we’ve added comments at the most important points. The “Settings” block at the very top is particularly interesting. There, you can specify, among other things, how often the upload folder is checked, how long a file must remain unchanged, and which video formats are supported. Keep in mind that YouTube might not handle all formats equally well, so it’s best to use the more common formats—especially MP4.
Another special feature is the `state.json` file, which our uploader creates itself if necessary—in case you’re wondering during the upload why there’s another file in the folder. The uploader uses this file to keep track of ongoing upload sessions. For example, if your internet connection is interrupted or your computer is restarted while uploading a video several gigabytes in size, the script checks with YouTube to see how much data has already been uploaded. As long as the upload session is still valid, the upload will resume exactly where it left off.
Testing Your First Video Upload
To upload a video, start the uploader with the following command:
.\.venv\Scripts\python.exe uploader.py
The script then automatically creates the three subfolders: “incoming,” “uploaded,” and “failed.” By default, it monitors the “incoming” folder every 30 seconds. Copy a short test video into the “incoming” folder. The uploader waits 2 minutes after the file was last modified and then begins the transfer. You can track the progress directly in the terminal. After a successful upload, a link to your video will appear in YouTube Studio. The original file will then be located in the “uploaded” folder.
Your video is initially private and can be further edited in YouTube Studio. During this first test, also check whether you can change the visibility to “Unlisted.” To exit the uploader, simply press Ctrl + C.
Step 4: Start the uploader automatically with Windows
Our uploader works now, but you currently still have to start it manually after every restart. Over time, this is obviously a bit of a hassle. Fortunately, this can be solved relatively easily with a small batch file and the Windows startup feature. Open Notepad again and paste the following code:
@echo off title YouTube Uploader cd /d "%~dp0" ".venv\Scripts\python.exe" uploader.py pause
Then save the file as starten.bat in your uploader folder. Make sure the Notepad doesn’t accidentally add the .txt extension.

First, close the currently running uploader using the [CTRL] + [C] shortcut to prevent two instances from monitoring the same folder at the same time. Double-clicking on starten.bat should then open a new terminal window where our uploader runs as usual. If everything works, the only thing missing is the automatic startup:
- Right-click on starten.bat and select “Create Shortcut.” On Windows 11, you may need to click “Show more options” first.
- Press [WINDOWS] + [R], type shell:startup, and press Enter. This will open the Startup folder for your Windows user account.
- Move the shortcut you created earlier into this folder.
- Right-click the shortcut to open its Properties, and under “Run,” set the option to “Minimized.”
From now on, your uploader will start automatically as soon as you log in to Windows. The terminal window remains minimized while the script regularly checks for new videos in the background. This means you can now export your finished videos directly to C:\YouTube-Uploader\input.
Of course, your computer must be turned on and must not enter sleep mode. Additionally, this method only starts after the user logs in, not when Windows boots up. If you want to run your uploader around the clock, a NAS or a small server is therefore the better choice.
For Advanced Users: Running 24/7 in a Docker Container on the NAS
Your computer isn’t always running, but your NAS is? Then a Docker container is the perfect permanent home for our uploader. A handy side benefit: You can copy your videos into the upload folder from any computer on the network. Your editing computer doesn’t even need to be turned on for this. We’ll walk you through the setup using a Synology DiskStation with the Container Manager as an example. Of course, you’ll need a model that supports Docker or the Container Manager.
The good news: You don’t have to go through the Google setup process again. After all, we’ve already completed the sign-in from Step 3 on our Windows computer. We’ll simply use the token.json file created during that process. It contains the necessary login credentials for our YouTube channel.
Prepare a Folder on the NAS
Open File Station on your Synology and create a new subfolder named `youtube-uploader` inside the shared `docker` folder. If you don’t already have a shared Docker folder, you can create one beforehand via the Control Panel.
Next, copy the files uploader.py and token.json from your Windows computer into this folder. That’s all we need for now. You can leave the original client_secret file and the virtual Python environment .venv on your computer. Make sure that not every user on your network has access to this folder. In particular, `token.json` contains confidential login credentials. These credentials ultimately allow our uploader to access your YouTube channel.
Finding Your User ID
To ensure the container doesn’t run with administrator privileges and the files remain under your ownership, we first need your user and group IDs.
If you’ve enabled SSH on your Synology, you can connect to the NAS and run the following command:
id
The output includes, among other things, the values uid and gid. On some Synology systems, for example, these are 1026 and 100. However, the correct values for you depend on your user configuration. Without SSH, you can also determine the values using the Task Scheduler. We show you how this works in the section “Finding Your User ID” of our tutorial on setting up Taiga on a Synology DiskStation.
Now open the Container Manager and navigate to “Project” in the left-hand menu bar. Then click “Create” and enter “youtube-uploader” as the project name. Select the previously created folder “docker/youtube-uploader” as the path. Under “Source,” select “Create docker-compose.yml” and paste the following code into the text field:
services:
youtube-uploader:
image: python:3.13-slim
container_name: youtube-uploader
restart: unless-stopped
user: "1026:100"
working_dir: /app
volumes:
- /volume1/docker/youtube-uploader:/app
environment:
TZ: Europe/Vienna
PYTHONUNBUFFERED: "1"
command:
- /bin/sh
- -ec
- |
if [ ! -f .venv-nas/.ready ]; then
python -m venv .venv-nas
.venv-nas/bin/python -m pip install --no-cache-dir --disable-pip-version-check google-auth google-auth-oauthlib
touch .venv-nas/.ready
fi
exec .venv-nas/bin/python uploader.py
Before you continue, be sure to check the user and group IDs in the line `user: “1026:100″` as well as the path `/volume1/docker/youtube-uploader`. Both values must match your Synology setup. For example, if your Docker folder is located on Volume 2, you must change the path accordingly.
Then click “Next,” skip the settings for the web portal, and complete the setup by clicking “Done.” After all, our little uploader doesn’t need a web interface.
Test the first upload via the NAS
When you first start it, Docker will download the Python image and install the Google libraries. This takes a moment. An additional subfolder named .venv-nas will also appear in the project folder, where the Python environment is stored. You can check whether everything is working in the Container Manager under “Containers.” Select “youtube-uploader” there and open the log.
After successful setup, a message should appear here indicating that our uploader has started and is monitoring the input folder. Now you can copy a short test video directly from your Windows computer over the network to the folder \\YOUR-NAS\docker\youtube-uploader\input—and, for added convenience, create a network drive for it.
Tip: If you plan to use the uploader exclusively on the NAS in the future, you should remove the startup shortcut from your Windows computer. Running two instances simultaneously that monitor the same files is not a good idea.