This application automates the process of downloading YouTube shorts, appending a video to them, and scheduling their upload to YouTube.
- Install dependencies:
pip install -r requirements.txt- Required Credentials:
credentials.json: Google Sheets API service account credentialsclient_secrets.json: YouTube API OAuth 2.0 client credentials
-
For Google Sheets API (
credentials.json):- Go to Google Cloud Console
- Create a new project
- Enable Google Sheets API
- Create a service account
- Download the JSON key and rename it to
credentials.json
-
For YouTube API (
client_secrets.json):- Go to Google Cloud Console
- Enable YouTube Data API v3
- Create OAuth 2.0 credentials
- Download the client configuration and rename it to
client_secrets.json
-
Go to the Google Cloud Console
-
Create a new project or select an existing one
-
Enable the YouTube Data API v3 for your project
-
Go to Credentials and create a new OAuth 2.0 Client ID
-
Download the client configuration file and rename it to
client_secrets.json -
Get your refresh token by following these steps:
- Go to Google OAuth 2.0 Playground
- Click the gear icon in the top right
- Check "Use your own OAuth credentials"
- Enter your client ID and client secret from the
client_secrets.jsonfile - Select "YouTube Data API v3" from the list of APIs
- Click "Authorize APIs"
- After authorizing, click "Exchange authorization code for tokens"
- Copy the refresh token
-
Update your
client_secrets.jsonfile to include the refresh token:
{
"installed": {
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"refresh_token": "YOUR_REFRESH_TOKEN",
"token_uri": "https://oauth2.googleapis.com/token"
}
}The application will now use these credentials directly without requiring web-based login.
The following YouTube API scopes are required:
https://www.googleapis.com/auth/youtube.uploadhttps://www.googleapis.com/auth/youtube
streamlit run app.py- Enter your Google Spreadsheet URL containing YouTube shorts links
- Upload the video you want to append to each short
- Configure the title and description templates
- Set up the scheduling parameters
- Click "Process Videos" to start the automation
Your Google Spreadsheet should have the following column:
youtube_url: The URL of the YouTube short to download
You can add additional columns that can be used in title and description templates.