Tip
- Go to the official Python website: https://www.python.org/downloads/release/python-3139/
- Scroll down to the files part. Then download the Windows installer (64-bit)
- Once downloaded, run the installer.
- ✅ Important: On the first screen of the installer, check the box that says “Add Python to PATH” before clicking Install Now.
Click the button below to download the code as a .zip:
Now extract the .zip folder
Open the command prompt inside the extracted folder and run:
py example.py
or
python example.py
This project automates video uploads to YouTube using Python and Selenium, by leveraging a saved login session through browser cookies.
- Automated login and cookie saving for YouTube using Selenium
- Video upload automation with metadata (title, description, tags, privacy, etc.)
- Simple example usage for customization
.
├── example.py # Example script showing how to upload a YouTube video
├── login.py # (Legacy) Script that logs into Gmail and saves cookies
├── gl.py # (Legacy) Experimental Google login with PhantomJS
├── cookies.json # Saved YouTube cookies for authentication
└── README.md # Project documentation
login.pyuses Selenium to log into Gmail/YouTube manually, waits for authentication, and saves the session cookies intocookies.json.example.pyloads those cookies and uploads a YouTube video automatically using aYoutubeclass (from the importedpackagemodule).- The upload includes metadata such as title, description, category, tags, and privacy settings.
Make sure you have Python 3.8+ installed. Then, install dependencies:
pip install selenium webdriver-managerRun the login script to create a cookie file:
python login.py💡 You will need to log in manually during this step. Once complete,
cookie.jsonwill be saved automatically.
Update the upload_info dictionary with your desired video details:
upload_info = {
"title": "My Awesome Video",
"description": "This is an automated upload.",
"video": "C:/path/to/video.mp4",
"thumbnail": "",
"category": "Music",
"privacy": "Public",
"tags": ["automation", "python", "youtube"],
"kids": False
}Finally, run:
python example.pyThe script will automatically upload your video using the stored login session.
- Do not share your
cookies.json— it contains authentication data. - Using automation to log into or upload content to YouTube may violate Google’s Terms of Service. Use this project only for educational or personal testing.
login.pycurrently hardcodes credentials — remove or modify before using securely.- The project depends on a missing module called
package(providing theYoutubeclass). Ensure it’s installed or implemented in your environment.
- Replace password-based login with OAuth2 for security
- Use YouTube Data API for compliant video uploads
- Add error handling and progress tracking for uploads
This project is provided for educational purposes only. You are responsible for ensuring compliance with YouTube and Google policies.
eqy