Python script that automatically creates a short video and posts it on Youtube Shorts
This is a personal project and is meant for educational purposes only. I am not responsible for any misuse of this program. Please use it at your own risk. Please DO NOT contact me for any issues with this program. It is simply just a proof of concept and is not meant to be used in a production environment.
This program automatically creates a short video and posts it on Youtube Shorts. It is intended to run on system startup and will post at a specified time. The program uses a random video and a random sound provided by you on top of which it adds a random quote and its author.
Clone the repository:
git clone https://github.com/GrecuAlexandru/silent_autopost.git
-
Register your application with Google so that it can use the OAuth 2.0 protocol to access Google APIs.
-
Download the
client_secrets.json
file from the Google Developers Console and place it insilent_autopost/Engine/YoutubeShorts/
. You will notice that it has a strange name likeclient_secrets_1234567890-abcdefg.apps.googleusercontent.com.json
. Make a copy of it and rename it toclient_secrets.json
. Keep both files in that folder.
-
Install the Google APIs Client Library for Python (google-api-python-client) using pip:
pip install --upgrade google-api-python-client
The installation guide from Google suggests to install the library in a virtual environment, but it is not necessary:
With virtualenv, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.
You can follow the guide here if you want to install it in a virtual environment.
-
Install the required packages:
pip install -r requirements.txt
-
Install ffmpeg and add it to the PATH environment variable. You can follow the guide here.
The program is intended to run on system startup and it will automatically create a short video and post it on Youtube Shorts at a specified time. You can change the time in silent_autopost/Engine/auto.py
. The default time is 11:00 AM, 13:00 PM, 18:00 PM and 20:00 PM.
Firstly, you must add your videos in silent_autopost/Videos/
and your sounds in silent_autopost/Sounds/
. The program will randomly select a video and a sound from those folders and combine them into a short video. The video must be in .mp4
format and the sound must be in .mp3
format. You can add as many videos and sounds as you want. There is a video file and a sound file in the Docs/Example/
folder that you can use to test the program.
You must modify the title and description of your Youtube short by changing the title
and description
variables in silent_autopost/Engine/auto.py
. Modify this line according to your needs:
command = 'python ./Engine/YoutubeShorts/upload_video.py --file="./Output/final_video.mp4" --title="<YOUR_TITLE>" --description="<YOUR_DESCRIPTION>" --privacyStatus="private" --noauth_local_webserver'
If you want to make the video public, you must modify the privacyStatus
variable in silent_autopost/Engine/auto.py
like this:
command = 'python ./Engine/YoutubeShorts/upload_video.py --file="./Output/final_video.mp4" --title="<YOUR_TITLE>" --description="<YOUR_DESCRIPTION>" --privacyStatus="public" --noauth_local_webserver'
You can run the program manually from the root directory of the cloned repository by typing:
python silent_autopost.py
Modify silent_autopost.cmd
with the absolute path to silent_autopost.py
and place it in the Startup
folder. You can find the Startup
folder by pressing Win + R
and typing shell:startup
. This will make the program run on system startup, but it will run in the background and you won't be able to see the console window.
To know the program is up and running, you can check the system tray icons for the Silent Autopost icon.
You can see what the program outputs by opening the file located at silent_autopost/App/output.txt
. If you want to see the console window, you must run the program manually in the command prompt.
- Python - Programming language
- Google APIs Client Library for Python
- Pillow - Used to add text to the video
- OpenCV - Used to make the video
- MoviePy - Used to make the video
- ffmpeg - Used to cut the video
- Youtube Data API v3 - Used to upload the video on Youtube Shorts
- Youtube Shorts - The platform where the video is uploaded
- ZenQuotes - Used to get random quotes
- Alexandru Grecu - Full project - GrecuAlexandru
This project is licensed under the MIT License - see the LICENSE file for details