- Authentication (client-secrets.json from Google API console)
- Head to the Google API Console at https://console.cloud.google.com/ and create a project.
- In the marketplace (search bar), find 'YouTube v3 API' and enable it.
- After redirect, click on Oauth Screen and create.
- Add google.com as the authorized domain.
- Add scopes for the YouTube v3 API.
- Add the channel's email as the test user (in most cases, the email the channel was registered with).
- Create Credentials (OAuth Client ID) in the Credentials Menu and select Web App.
- For Authorized Redirect URIs, use:
- Finish up with downloading the .JSON file and put it inside this repository's directory.
- Oauth2.json (within the repo itself)
- Once a valid
client_secrets.json
is present in the directory, runpython3 upload.py
and follow further instructions. After successful authentication, anoauth2.json
file will be created inside the directory.
Note: You can avoid quota bottlenecks by stacking up projects in the google console and repeat steps before
- Automation
Once valid oauth2 credentials exist in the directory you can let this run 100% on autopilot.
ultra.py
is the main script to direct the video production pipelingupload.py
sets the backbone for youtube's v3 api to upload to YouTube without further authentificationfinal_upload.py
combines the finsished product and uploads it to YouTube (title, description, tags get parsed automatically)
Just craft your own bash script or use automate.sh
- access YouTube as provider of video assets, surpassing stock footage by large
- avoids bans by using download streams with PyTube
- avoids YouTube v3 API's rate limit and auth
- avoids Pexels hard rate limit
Inside api_utils
functions provide utility for working with different APIs. Files: image_api.py
, pexels_api.py
, youtube_api.py
and eleven_api.py
. We added youtube_api.py
to source video assets directly from YouTube. Feel free to modify the _generateVideoUrls
function for the hierachy of video asset sources.
-
The search_videos_YouTube function takes a query string as input and searches for a video on YouTube based on that query. It returns the URL of the first search result if found, or None if no video is found.
Integration of
shortGPT.api_utils.youtube_api
, which serves as an additional source for gathering footage based on the queried keyword. This is particularly useful when dealing with niche / comedy / meme topics where stock footage is not available. If nothing matches we backtrack to the pexels API.