A modern interface for automating a browser to upload videos to YouTube.
Project description
TheToob
"Hey bubba, what's on the Toob?"
TheToob is a Python package for uploading videos to YouTube using Selenium. It's a heavily modified and modernized fork of the original youtube_uploader_selenium by linouk23, refactored for robustness, maintainability, and modern features.
Like the original, this tool automates the browser to upload videos, bypassing the daily quota limits of the official YouTube Data API.
⭐ Key Features & Improvements
- Modern Architecture: Fully refactored into an object-oriented structure (
Uploader,UploaderPage,ToobBrowser) for better readability and maintenance. - Headless Operation: Run the uploader in the background without a visible browser window, perfect for servers and automation scripts.
- Robust Error Handling: Automatically saves a crash report with a screenshot and HTML dump if an operation fails, making debugging significantly easier.
- Enhanced Stability: Uses explicit waits and more reliable element locators to prevent common race conditions and timing errors.
- Updated YouTube Options: Supports newer metadata fields including:
- Video
visibility(Public,Private,Unlisted) paid_promotiondisclosuresaltered_contentdisclosures for AI-generated or modified media
- Video
- Simplified Dependencies: Uses the core
seleniumlibrary directly, removing the need for extra wrappers.
⚙️ Installation
pip3 install --upgrade the-toob
🚀 Usage
The package is designed to be used as a library within your Python projects.
🤓 First-Time Setup: Creating a Logged-in Profile
Due to Google's security policies, you cannot log in for the first time within the automated browser. You must first create a dedicated Firefox profile and log in manually using a normal browser window.
This is a one-time setup.
-
Open Firefox: Launch your regular Mozilla Firefox browser.
-
Go to Profiles Page: Type
about:profilesinto the address bar and press Enter. -
Create a New Profile: Click the "Create a New Profile" button and follow the wizard.
-
Set the Profile Path: When prompted, click "Choose Folder...". Navigate to your project's folder and select the
profiles/firefox_profiledirectory. This is critical for linking the profile toTheToob. -
Launch and Log In: Find your new profile in the list and click "Launch profile in new browser". In the new Firefox window that opens, navigate to YouTube and log in to your Google account as you normally would.
-
Close the Profile: Once you are successfully logged in, you can close that Firefox window.
-
Run
TheToobfor the First Time: Now, run thethetoobcommand from your terminal. The script will open the browser you just logged into, pause with a message about saving cookies, and create thecookies.pklfile.
After this initial run, all future runs can be fully automated and headless.
Standard (Headless) Upload
Once authenticated, you can run the uploader in headless mode.
from youtube_uploader_selenium import Uploader
import logging
logging.basicConfig(level=logging.INFO)
# Define your video metadata
# This can also be loaded from a JSON file (see below)
video_metadata = {
"title": "Mr. Game & Watch: The Secrets of Nair 1, 2, and 3",
"description": "Sure, the fourth one pops them up, but Ftilt is cool, too...",
"tags": ["carried"],
"visibility": "PUBLIC",
"paid_promotion": False,
"altered_content": False
}
uploader = Uploader(
video_path='path/to/your/video.mp4',
thumbnail_path='path/to/your/thumbnail.jpg', # Optional
metadata=video_metadata,
profile_path='path/to/your/firefox_profile',
headless=True # Headless is now possible
)
was_uploaded, video_id = uploader.upload()
📝 Metadata Guide
You can provide metadata as a dictionary (as shown above) or as a path to a JSON file.
Example metadata.json file:
video_metadata = {
"title": "Mr. Game & Watch: The Secrets of Nair 1, 2, and 3",
"description": "Sure, the fourth one pops them up, but Ftilt is cool, too...",
"tags": ["carried"],
"visibility": "PUBLIC",
"paid_promotion": False,
"altered_content": False
}
Metadata Fields
title(str): The video title. If not provided, it defaults to the video's filename.description(str): The video description.\ncharacters are respected.tags(List[str]): A list of tags for the video.visibility(str): Sets the video's visibility. Must be one ofPUBLIC,PRIVATE, orUNLISTED. Defaults toPRIVATEif not specified.paid_promotion(bool): Set toTrueif the video contains a paid promotion.altered_content(bool): Set toTrueif the video contains significantly altered or synthetic content that looks realistic.
💻 Command-Line Usage
Once installed, TheToob can be used directly from your terminal.
Basic Usage:
thetoob --video "path/to/my/video.mp4"
# Full Featured Usage:
```bash
thetoob --video "video.mp4" --meta "metadata.json" --thumbnail "thumb.jpg" --headless
Alternative Usage:
You can also run it as a Python module.
python3 -m the_toob --video "video.mp4"
Available Arguments:
--video: (Required) The path to the video file you want to upload.
--meta: (Optional) Path to a .json file containing the video's metadata.
--thumbnail: (Optional) Path to a custom thumbnail image for the video.
--profile: (Optional) The directory to use for the Firefox profile and cookies. Defaults to ./firefox_profile.
--headless: (Optional) A flag to run the browser in headless mode (no visible UI).
📦 Dependencies & Driver Management
- Mozilla Firefox: A modern, up-to-date version is recommended.
- selenium: The core automation library.
A Note on GeckoDriver
Modern versions of Selenium (4.6.0 and newer) include Selenium Manager, a tool that automatically downloads and manages the necessary web driver for you.
For most users, this means you do not need to manually download geckodriver. The first time you run TheToob, Selenium will download the correct driver and cache it for future use.
Manual Override: If you are behind a strict corporate firewall or run into any driver-related issues, you can still fall back to the manual method. Download the latest geckodriver from its official releases page and ensure the executable is in your system's PATH.
❤️ Original Project & Credit
TheToob is built upon the foundational work of linouk23. A huge thank you for creating the original tool and sharing it with the community.
- Original Author: linouk23
- Original Repository: youtube_uploader_selenium
🤝 Contributing
This project is maintained on a best-effort basis. While I may not be adding many new features myself, I welcome contributions from the community to help TheToob grow. Feel free to open a pull request!
📄 License
This project is licensed under the MIT License. Please see the LICENSE file for full details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file the_toob-1.0.0.tar.gz.
File metadata
- Download URL: the_toob-1.0.0.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
999023a11f7c12deace9acb57b70776c7bd56bd83cad6bcf33e7b943e225583f
|
|
| MD5 |
25fbee09926aade77788f6e92f15571d
|
|
| BLAKE2b-256 |
65ab07384d3fb3fa24b8bce4d09454f5aaa0ebd4a0998aa1c4e8f093e2a7c201
|
File details
Details for the file the_toob-1.0.0-py3-none-any.whl.
File metadata
- Download URL: the_toob-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac3546e8f0a257336aa04d79db97a6d11910715a7850dbc97fb3e7171870bb85
|
|
| MD5 |
964c6b78e7adb423f67f7d7abee81f88
|
|
| BLAKE2b-256 |
ec8e396c7624105a31bff6213e2d5cbcea86b88200332e6d0c461296724498b0
|