Get 100% Free Traffic From YouTube – Python Automated Full Guide
In this guide, you will learn how to get free traffic from YouTube shorts and how to automate the process with Python. There are countless different ways to make various twists to this process as well as look for different niches and monetization options. The intention of this guide is to demonstrate how to achieve a fully automated & free traffic source.
It is not intended for you to copy the methods shown as examples in this article. This is not a money-making guide, but rather a well-researched traffic method with monetization ideas. All the code shared in this guide has been tested and working as of its release.
There might be changes to YouTube’s algorithm in the future, so please understand that you might need to adapt the methods accordingly. YouTube does not like automated channels and makes changes to the upload process often. In case the upload script has stopped working, reply in the comment section and also share with your friends on Facebook, please enjoy.
CREATING YOUR CHANNEL
When it comes to short vertical videos YouTube does not care about the age of the account as long as you can verify the phone number and email associated with the account to unlock extra features such as community posts and links in the description. However, YouTube tries to copy TikTok and push the content to the viewers from the country of origin.
This means that if you create a channel and upload a short video from Ireland, over 90% of the viewers of the video will be from Ireland and YouTube will try to push it locally as much as possible. Luckily this is not TikTok and can be overcome fairly easily. The recommended method throughout this guide is a dedicated VPS. My personal, fully automated shorts channel is running on a shared VPS with 1 CPU core and 2GB of ram. It takes a lot of time to render, but because it’s automated, the speed of it does not matter to me. Virtual servers with such specs can be had from as low as $5/mo.
If you are not willing to make any investments without making money first, you can easily run everything on your PC.
GETTING THE CONTENT
There are a million ways to get content for YouTube shorts, but in this guide, I will show examples with Cartoons and Reddit stories. Both of the example ideas can get a lot of daily traffic, but these might not be ideal niches for monetization. You can rather simply adapt the methods
demonstrated below to fit your own ideas and niches.
Example 1: Short Reddit horror stories
Example 2: Random funny cartoon clips
BEGINNING THE AUTOMATION
Step 1. You will need Python to run the automation. As of the release of this guide, the most stable version for our purposes will be 3.9.16 (not the latest one)
Step 2. Installing required libraries. To make things easier we will install some Python libraries that will help us with the automation process. To install a library just open the terminal and type pip install library-name.
Create a new folder for your project, type cd, and drag&drop the folder on top of the terminal window. Then we can start installing libraries. It should look like this:
Here is the list of all the libraries we will need:
Other requirements:
- eSpeak TTS module for Windows
- Some sort of text editor of your choice
- FFMPEG library for Windows
- ImageMagic editor software
Step 3. We will need some content to work with and the first example is going to include Reddit. Not many people know of this feature Reddit has. If you go to any subreddit and type /random in the URL bar, you get a random thread from that subreddit. This means that the system to get content is already in place, we just need to ‘scrape it off’. I personally like horror stories, so let’s try to create some short horror clips using stories from /r/shortscarystories.
So we found the content we want, but we don’t want to copy-paste it each time ourselves. Let’s write a short script that does it for us. As of writing this guide, Reddit still has their old mobile website active, which is super convenient for scraping, as it is simple and loads quickly. We can access it by typing i. In front of the reddit.com.
The main goal of this script:
- Navigate to https://i.reddit.com/r/shortscarystories/random
- Find the element of the body text
- Extract the story text from the element
- Save the story to file
We can easily find the needed element and their classes using inspect tool in any browser. Here is how it looks:
As you can see the main body text of the post just sits between some div tags with a class named ‘usertext-body’. All we have to do is tell our bot to navigate to the webpage, find the element with the same class, and get the text. For this task, we will be using the Requests library to access the site and BS4 to interpret the site’s HTML. Just like any popular website, Reddit does not like bots crawling their page, but luckily they are not that strict about it as long as you aren’t
causing too much trouble. Let’s use a random user agent just in case. If you want to scrape data in greater amounts, you can do so by using their API but for this tutorial, we will keep it simple. Keep in mind that the green lines with hashtags are Python comments mean for the reader to better understand the context. Here is how the code looks:
It should be saved with .py file extension and can be tested by opening the terminal and typing py yourscript.py The script should create a new .txt file in the same directory with content similar to this:
Step 3. We have the content, let’s make a video! You could do it manually, but that’s no fun, so let’s write another Python script that turns this into a video. This video will consist of:
- Stock Background.
- Footage Overlay.
- Story Subtitle.
- Text to Speech Voiceover.
- Background Music
For this demo, I will be using this background video and this background music. Now that we have everything we need, let’s get started. The goal of this script is to crop the stock background footage to a 9:16 aspect ratio, use TTS to turn the Reddit story into audio, chop it into separate lines of text that would fit on the screen, use TTS to turn these lines into audio and overlay it with some background ambiance. Sounds like a good recipe? The code for this task is quite long, but don’t worry, it’s not that scary when you read it. For convenience’s sake, I divided it into two parts:
At the beginning of this code, we define the necessary libraries and download the NLTK module that helps to divide our script into smaller sentences for subtitles to fit the screen. Then we select the desired TTS voice. When trying this code for the first time TTS library will download the selected voice. This particular library has almost 100 voices to choose from and about 10% of them are very good in my opinion. There are also quite a few languages besides English. Here is the full list. Just change the model_name number to choose the voice you want. The second part of this code is fairly straight forwards, we just declare what files we will be using to create this video and then cut the background video to fit the vertical format. Let’s move on to the second part of the code:
First, we begin by creating the subtitles, then set their styling, overlay them over the main video, and fine-tune the results by changing the clip speed and length. Some of the stories in this subreddit will not fit into a 60-second short video.
There are multiple ways to solve it (find shorter stories, making multiple parts, uploading the full story as a regular video, etc.) In this example, videos will be cut at exactly 60 seconds to qualify as shorts. As you might have noticed there is no code to generate subtitles. In line 88 we call a function named subtitles, but I haven’t included it in this screenshot, because it’s large and complicated. Think of it like a car – you don’t need to know how the engine
works to drive it. I tried my best to comment on every line to make it as easy to follow as possible, but the only thing that might need adjusting is the max word count per line and subtitle speed. Here is how the function looks:
I marked the number that changes the subtitle speed (less
= faster), but to change the max word count per 1 subtitle line you will need to change all the 4s to a desired number. The current setting is max 4 words per subtitle line as with the current font it’s difficult to fit more in a vertical video.
This is only meant to introduce the code and make it seem more friendly for beginners, the complete and ready-to-be copied scripts will be shared at the end of this guide.
Example 1
Now we have 2 scripts that can be easily joined to generate endless short horror video stories. I do not think this is a production-ready copy-paste example, but I am sure with some ideas of your own and a slight tune of the code you can auto-generate amazing content that will get thousands of views per upload. Curious to see an example that was generated by the script above? Here it is!
You might be thinking, but how the content is endless if you are just using one background video and the same music over and over again? That’s right, let’s continue on to example 2 to learn about ‘content folders’ and how to randomize elements to produce unique videos each time.
Example 2
This is the easiest way to get traffic from YouTube shorts. I tried it multiple times and the views were overwhelming each time. It might not be the ideal niche for monetization, but traffic is traffic and you can figure out how to get some money out of it regardless. In this example, I will show you a script that cuts random clips from popular tv shows or cartoons, makes it a bit more difficult to detect for the YouTube algorithm (even though shorts allow some copyrighted content), and finally add some text that encourages viewers to check the comment section. There is not much introduction necessary as the code is quite short and simple. However, you will need a folder with .mp4 files of your favorite tv show episodes to get started. Here is a folder I have of some cartoon episodes:
Now that you have a folder with some content ready, let’s look at the code that turns it into shorts:
Don’t be intimidated by the size of this script, as 60% of it is just comments.
Just like the previous script we start by importing the needed libraries and choosing the files. Unlike the previous example, we do not choose a single file, but rather a whole folder and pick an episode randomly. You can use this method for all the content from the previous example and generate videos with random backgrounds, music, and other elements picked by the script each time. It is also possible to randomly scrape this content from other online media sources.
This eliminates the need to switch the content manually each time. You can also write a simple addition script that prevents duplicates as that might happen sometimes. Getting back to the code, we take a random .mp4 file and cut a short clip from it, excluding the intro and end credits. Then we mix it up by mirroring the clip and slightly speeding it up.
After the clip is done we overlay some text for our monetization needs and render the final product. It’s barely noticeable that the video is mirrored, cut, and sped up, most short viewers will enjoy it regardless. Want to see a video generated by this code? Here it is!
Preparing for takeoff.
Just like everything you upload on YouTube, these videos will need titles, descriptions, and tags to get those views.
We sure don’t have time to write it all ourselves every time, so here is some code we can add to generate dynamic text for our uploads. I would recommend adding as many options for the title, description, and tags as possible, so each generation would be somewhat unique and less repetitive. Usually, you would want to max out the tags as well for the best ranking.
As you can see the majority of the code is just arrays filled with options, which are randomly selected and saved to file in the end. In line 5 we can see that the title will always start with the word ‘Cartoon’ followed by a randomly chosen option from variable pos1, then we have a # with a counter variable that returns the number of our video, and finally the file name between the brackets. Assuming the file is named “Simpsons S12”, a possible outcome could be “Cartoon Deleted Scene #2 (Simpsons S12)”.
The ‘\n’ command is added for a new line. The same thing happens with the descriptions, except the triple quotes enclosing the code mean that it is in multi-line mode and no ‘\n’ commands are needed to change lines. Adjust this as per your needs to build the desired dynamic text generator.
As you can see line 10 is a very basic attempt to join 3 tags together, but usually, we want around 10 relevant tags to rank our video as well as possible. This can be achieved with a simple loop like this:
You might notice that the last line of the description also includes some tags, why is that? As previously mentioned YouTube is trying to be TikTok and started to prioritize tags
that are in the title or description instead of the ones buried deep in the metadata. This means that it is currently beneficial to include tags not only in the dedicated spot but sprinkle some in the video titles or descriptions for that ultimate ranking boost. Don’t forget that #shorts!
After a bit of practice and trying out both of these examples, you should be able to make your script that chooses the content and turns it into a short video suitable
for YouTube shorts. The quality of that video will mostly depend on the materials chosen, but overall it’s currently very easy to get traffic, even if your videos aren’t the best. Some people do the Reddit stories with Minecraft parkour backgrounds and TikTok TTS voiceovers. As we all know those videos are terrible, but get millions of views anyway. The sky is the limit, use your imagination and automatically generate videos that can be uploaded multiple times a day to get thousands of clicks.
Automatic The Uploads
So now we have a video made by a bot, but can a bot upload it too? Sure, can! Let’s create a script that uploads our videos to complete this automation challenge. For this method, we will be using NodeJS & Puppeteer instead of Python & Selenium, because Selenium uses a web driver that can easily be detected and is not welcome by most websites, including YouTube. Puppeteer is not fool-proof either, but I have been using this method for months and it’s working flawlessly. Keep in mind that it is officially not allowed to automate the upload process on YouTube, so I am obligated to say that I am not responsible for any issues caused. To begin, download NodeJS and install the required libraries similarly to before. To begin this project, we will need the Puppeteer library, which you can get just like this
Once that is installed, let’s grab the delay-random library as well. It’s not necessary, but very convenient and does exactly what it says. When the node packages are in place and you can see the node_modules folder present, we can create a new file named uploader.js and start working on the code.
Now please be warned that this is some messy, low-level code, but due to how often YouTube changes the upload process, it makes it easier to implement any changes:
As you can see it just goes through the upload process as a human would and uses keyboard navigation for the elements it cannot reach by mouse. At the beginning of the code, the upload_text.js is read and stored in an array line by line. Assuming that line one is the title, line 2 is the description, and the last line is the tags. The text is accessed and typed by this command:
await page.keyboard.type(lines[0], {delay: 100});
Line 0 is the first line of the file, the delay simulates human typing.
Before we can try this code out, you will need the upload_text.txt file we created using the previous script as well as the cookies from your YouTube account, to access it. Open your YouTube studio as you usually do and install this extension then export all the cookies from the site. This should leave you with a file called cookies.json. Now we can take the upload bot for a spin. Open the terminal and type node uploader.js to launch the script and begin the upload process.
There are many ways to improve this code as it is as basic as it gets so that beginner readers would not have too much trouble understanding what is going on with it. I would not call this code very elegant either, it is just forcing its way through the upload page, but I do not think it matters as long as it achieves the desired action. Feel free to improve and make this bot more sophisticated.
As you might have noticed I am not using a headless browser, meaning that you will be able to see a browser window opening and the script controlling it. Many people would prefer using the headless mode to hide the browser and let the action happen in the background, but unfortunately, YouTube easily detects headless attempts and closes them down. If you have a method to upload in headless mode please share but for general automation purposes, this works just fine.
If you do not wish to add comments to all your uploaded videos, you can remove everything from ‘#share-url’ to ‘upload completed’ and have a regular uploader script.
If you wish to change the video category or any other upload options, add the necessary code after line 68. This is a part of the code where the tags are entered and most menus for category or language changes are accessible.
Final Step
STEPS Setting everything up
Wonder how to set everything up on a VPS to get passive traffic going without any user input just as promised? Let’s run through the final steps to fit all the pieces together and reach that satisfying total automation. This will allow you to keep the traffic coming even when you sleep, isn’t it wonderful?
Step 1. Due to the upload script not working in a headless mode, we will need to trick Windows into thinking that someone is logged in to prevent it from closing the GUI. This can be easily done with an old utility called ‘RDP Wrapper’ I am using an old Windows Server VPS, so I cannot guarantee that it still works on the latest Windows 11 images, but most VPS providers allow you to choose an older version for compatibility purposes anyway. Install the software and try opening the configuration .exe file. This piece of software might trigger some antivirus programs, but it is a false positive with no harm. Set your configurations to be like this:
If everything was done correctly you should be able to open the RDP window and connect to your own desktop ‘remotely’ just like this:
By keeping this connection active and working on the ‘remote’ computer you trick Windows into thinking that there is always someone logged in. Essentially, it just creates an endless loop where one user is dependent on another user.
Step 2. Let’s pretend we are going with the cartoon clip niche and we want to upload daily clips of random cartoons. To make this happen we need to trigger our script every day at a selected time. This can be easily set up using the built-in Windows Task Scheduler. To be able to launch a Python script from this application, we will need to create a helper script. Open a new text file and write this batch command in a single line:
“C:\Users\Administrator\AppData\Local\Programs\Python\Python39\python.exe” “C:\Users\Administrator\Desktop\folder-name\yourscript.py”
Adapt them as necessary to work on your machine. Now save this file with a .bat extension, open the Task Scheduler, and select ‘Create basic task’. Name it however you want and select how often you want the videos to be uploaded. When you reach a ‘start program’ page, browse and select the .bat file we have created previously. Now copy the path of the .bat file and paste it into the ‘Start in’ field without typing in the file itself. It should look like this:
Once that is set, save the task and adjust the timing as needed, there is plenty more detailed tutorials on YouTube as this guide is not about the Windows Task Scheduler.
Step 3. Now we have a Python script that will get triggered once (or more times) a day automatically and generate a video on its own. But our upload script is on a separate file in a different language, how do we join them? To do this, we tell the Python script to launch the uploader script after the video is ready, by using this simple command:
execute_js(‘uploader.js’)
It’s really that simple! However, for that command to be accessible you do need to include the Naked module first. from Naked.toolshed.shell import execute_js, muterun_js Now every time the video generator script is launched, it will prepare a new video and automatically call the uploader to upload it.
Conclusion.
Make sure you have read through the code and are familiarized with the commands. This might be a bit tricky to orchestrate for the first time, so here is a flow chart that should help you understand better:
- Task Manager set to launch start.bat at 1 am
- The time is 1:00
- start.bat is active
- The batch command triggers cartoon_short.py
- Video is generated and saved as clip.mp4
- Video title & description generated and saved as desc.txt
- Python is calling NodeJS uploader.js script
- uploader.js looks for cookies.json & desc.txt
- uploader.js launches Chrome and starts uploading
- uploader.js finishes the upload and adds a comment
- uploader.js closes
- cartoon_short.js close
- task finished.
I am sure that there are many different ways to do this, but the basics are here for you to grab and apply. This should not take longer than an hour to set up in total and the traffic you will get passively should be truly impressive.
SHARING IDEAS
Let’s begin this chapter by talking about the frog in the room – Coqui TTS. It’s the Python TTS library we have used in the first example. This library has plenty of options and settings to play around with to get that perfectly realistic human voice out of a single file on your computer. I agree that the voice in the example is not perfect, but if you take a moment to read through the library’s documentation and learn how to adjust and fine-tune the details as well as import custom voice packages from other creators and alter word pronunciation or use multiple speakers at once.
I would also like to remind everyone that there are more languages than just English and some content might be even easier to rank and get views in other languages. If you have an Nvidia GPU you can also use your CUDA cores to speed up the TTS generation and render videos in seconds.
Now you probably noticed that the monetization examples in this guide are not the best. However, this guide is about teaching how to get large amounts of free traffic. It is up to the individual reader how to monetize or utilize that traffic. That said, I will share one beaten-to-death idea, that still somehow works.
Game hacks. With a tiny bit of brain power, you can easily adapt the scripts from this guide to generate endless short game hack videos with download (CPA) links in the comments. There are plenty of subreddits sharing modded APK files and there is already a way for you to get those posts.
All left to do is add some extra elements to make the videos more appealing to a younger audience and you are making money from the automated YouTube Shorts channel! I tried it myself and it works, however, I would only recommend this niche if you are desperate, because the competition is massive. I bet there are at least a million niches that could be used in conjunction with this automated shorts method.
Take your time to test the scripts out, get familiar with each line of code and adapt it to any niche to make that money.
How much traffic can you get?
Here is a screenshot from a channel I created 1 month ago. All the content uploaded is just movie clips using the method from example #2. I only logged in to this account a few times to check the stats. All the traffic was made completely passively with no input from me. I did try to include a link in one video but have not made any effort to promote it. You can see the clicks in the first graph. This channel is no longer active as I am working on different niches right now, but it is still getting decent daily views.
I truly think that this shows how much it can be scaled. Imagine creating 10 channels that are completely automated and easily getting 1000 clicks to your CPA offer every day. This is possible if you take action and invest the time needed to set everything up in a sensible way. Don’t skim out on the content either. It does not mean that automated videos have to suck. Some of them can truly be entertaining and valuable to the short community.
There is also always a possibility to get monetized by YouTube directly. All you have to do is fine-polish that robotic voice to sound more like a human, spend more time cleaning up the raw content to fit the video format better, and reach a level of production that might be deemed acceptable by YouTube gods.
Let’s not forget TikTok and the massive user base there. I do now have a reliable method to share on how to upload content automatically to TikTok, but I am sure that some of the scripts from this guide can be adapted to automate traffic from any platform.
If you come this far into this guide, thank you for reading and I hope it was a valuable piece of information. Test it for yourself. Now go make that traffic start flowing!
SBMM Happy Learning