---
title: 'I Automated YouTube Shorts with Python'
source: 'https://youtube.com/watch?v=mkZsaDA2JnA'
video_id: 'mkZsaDA2JnA'
date: 2026-07-28
duration_sec: 210
---

# I Automated YouTube Shorts with Python

> Source: [I Automated YouTube Shorts with Python](https://youtube.com/watch?v=mkZsaDA2JnA)

## Summary

The video demonstrates how to automate the creation of YouTube Shorts using Python, leveraging libraries like MoviePy, APIs for stock footage and text-to-speech, and AI for script generation. The creator builds a simple frontend that generates a complete video from a user-provided idea, then tests it on a channel with modest success.

### Key Points

- **Inspiration and Goal** [0:00] — The creator saw random fact YouTube Shorts and decided to automate their creation with Python using minimal effort.
- **Tech Stack** [0:16] — Uses Python with MoviePy for video editing, Bing version of ChatGPT for script generation, Pexels API for stock videos, TikTok TTS unofficial API for text-to-speech, and AssemblyAI for generating subtitles.
- **Frontend and Script Generation** [0:27] — A simple frontend allows entering a video idea, which triggers ChatGPT to generate a script and search terms for stock footage.
- **Stock Video Handling** [0:46] — Pexels API provides free stock videos, but resolution issues required cropping instead of resizing to avoid glitches.
- **Text-to-Speech and Subtitles** [1:09] — Used TikTok TTS unofficial API for speech, then AssemblyAI to generate a transcript with timestamps in SRT format for subtitles.
- **Testing and Results** [1:45] — The backend generates a video; the creator shows a sample output about the Amazon rainforest. Testing on a channel yielded a few 1K-view shorts.

### Conclusion

The project successfully automates YouTube Shorts creation, achieving modest viewership. The creator plans to release the code on GitHub for subscribers.

## Transcript

when I was scrolling through YouTube
shorts yesterday I came across these
videos seeing random facts about the
world here's an example meet the
immortal jellyfish a mesmerizing
creature that defies the boundaries of
life and death and I just thought how
easy these would be to automate with
literally little to no effort here's how
that went I wanted to use Python to do
this project since you can easily edit
videos with it using a library called
movie pie and because this is
essentially free money method I named it
money printer first of all I created a
very simple front end where you can
enter your video idea and it will
automatically generate the video for you
since I already know how to use the Bing
version of cgt with python from previous
projects I let it create a video script
based on the provided user idea now that
I have the script next up is to find
good stock videos based on Search terms
that jpt also generated for me for this
I used the pixels API which is very easy
to use and also free there is one
problem however I don't know the
resolution of the videos that the pixels
API provides me with so I need to
manually resize them using movie pie
which is a pain since most of the time
it simply renders this weird TV glitch
screen but somehow I managed to fix it
by cropping the video clips instead of
resizing them now I had to find a form
of Texas speech which didn't sound too
robotic but I obviously don't have
enough money for the 11 Labs API so we
went with a Tik Tok TTS unofficial API
from GitHub and it was converting the
sentences in my script just fine there's
a platform called assembly Ai and this
is what I used to get a transcript of my
just generated Texas speech as it would
include timestamps and it can save the
sub it in the SRT format movie piie
comes in clutch Again by letting me burn
subtitles into the video easily by
concatenating the original video file
with a subti clip class instance which
just needs the path to my just exported
SRT file with that the application is
basically finished Let's test it out
okay let's run our back end all right
should be running now let's click on
generate and now wait right now it's
generating or generating our
script it's generated it now these are
the Search terms which we are going to
use with the pixels API here are the
videos it shows now it's downloading
those okay it prints the script again
now it's completing the text of speech
using the Tik Tok API or unofficial API
all right now it's generated the
subtitles with the assembly Ai and last
but not least it's combining everything
together and once this is done we should
have our output. MP4 I'm going to speed
up this process a little bit cuz it's
boring all right it seems like we still
have to do something so I'm going to
take that sacrifice because I'd rather
wait a little while than edit all these
videos myself so I'm fine with that
great now it's done with that said let's
have a look at our video the Amazon
rainforest is the largest tropical
rainforest in the world covering an area
of approximately 5.5 million square km
it is home to a diverse range of plant
and animal species many of which are
found nowhere else on Earth this looks
good enough just so you don't think this
was just some useless project I actually
tested these clips on a channel and here
are the
results as you can see I did get a
couple 1K views shorts which is pretty
impressive for an automation bot in my
opinion if you guys want the code like
And subscribe as I'll be posting it on
GitHub in the upcoming days till next
time oh
