avatar temp

Antoine Chatry

codewars score

How does my YouTube bot work?

I'm proud to share with you my YouTube bot, a tool I developed to create videos from Reddit content.

This bot is designed to browse specific subreddits, extract the most recent posts, translate their content into another language and create videos from the translated text. Here's how it works:


1. Collecting data from Reddit

First, my bot will search for the latest posts of a subreddit I'm interested in.
I use a Python library called PRAW to access the Reddit API and get the data I need.
Then I save them in a CSV file for easy manipulation.

2. Filtering posts

Once I have the posts, I make sure not to include those containing images, gifs, videos or other links. I use regular expressions to filter out unwanted posts. This ensures that only posts with text will be considered for further processing.

3. Translation of posts

Now that I have selected the right posts, I translate them into another language.
To do this, I use the Python library from DeepL.

4. Creation of audio files

Once I have the translated posts, I convert them into audio files. For this, I use a Python library called "gtts" (Google Text-to-speech). It's a tool that allows me to generate audio files from text. I save the audio files in MP3 format so I can create my mp4 file in the future.

5. Editing the video

Now that I have the audio file, I can create the video.
I use a Python library called "moviepy" to assemble the audio file and the images in order to create a .mp4 file.

6. Publication on YouTube

Finally, the video is published on Youtube automatically. Thanks to the Youtube API.


I hope this article has given you an interesting insight into my YouTube bot!