This repository contains a Python script to upload videos to YouTube using the YouTube Data API v3. The script handles authentication, video metadata configuration, and uploading.
Before you can use this script, ensure you have the following:
- Google Developer Console Project: Create a project and enable the YouTube Data API v3.
- OAuth 2.0 Credentials: Obtain your OAuth 2.0 Client ID and Client Secret.
- Python Environment: Ensure you have Python installed.
- Navigate to the Developer Console: Go to Google Developer Console.
- Create a New Project: Click on "Select Project" at the top, then "New Project". Give it a name and create it.
- Enable YouTube Data API v3: Go to "API & Services Dashboard" and click on "Enable APIs and Services". Search for "YouTube Data API v3" and enable it.
- Set Up OAuth Consent Screen: Go to "OAuth consent screen" on the left, select "External", and fill in the required details.
- Create OAuth 2.0 Credentials: Go to "Credentials", click on "Create Credentials", and select "OAuth 2.0 Client IDs". Download the JSON file with your credentials and save it securely.
Install the necessary libraries using pip:
pip install google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client
- Place the Credentials File: Ensure the
client_secrets_file
path in the script points to your downloaded credentials JSON file. - Update the Script: Modify the script as needed for your video upload. The script includes authentication and upload functionality.
Run the script from your terminal or command line:
python run.py
The script will prompt you to authenticate with your Google account. Once authenticated, it will upload the specified video to your YouTube channel.
The script performs the following tasks:
- Authenticate with Google: Uses OAuth 2.0 to authenticate with the YouTube Data API v3.
- Upload Video: Uploads the video to YouTube with the specified metadata.
If you encounter issues, ensure that:
- The credentials file is correctly placed and the path is correct.
- You have enabled the YouTube Data API v3 in your Google Developer Console.
- The necessary libraries are installed in your Python environment.
This project is licensed under the MIT License. See the LICENSE file for details.