Making Automatic YouTube videos with Python
Вставка
- Опубліковано 25 вер 2024
- Using Python to completely automate content from Reddit into a popular UA-cam channel! With tools like Selenium, MoviePy, and Reddit's API, it's possible to create a video at the push of a button. This was a fun little project for me to practice Python, but I was surprised how successful UA-cam shorts are at getting views.
Source Code (reference only): github.com/Shi...
Reddit API: / apps
MoviePy: zulko.github.i...
Music:
chill by sakura Hz
Interesting project but I *really* appreciate that you took the time to explain each step in just the right amount of detail.
Thank you! Editing alone took about twice the time as the project itself, so I'm glad ot was worth it
@@ShiftyTheDev It's a very good example of a meaty project, I'll be pointing my students to it. Thanks for sharing!
Nothing else to explain if u cant make that urself than never try it anyway
Maybe, Try building calculators first
Just want to pin this here for anyone who wants to pursue making money with this idea:
1) To monetize shorts on UA-cam you need 10 MILLION views in the last 90 days.
2) This content likely won't be eligible for monetization
You may be rejected from monetizing your channel as it could be a violation of repetitive content. The goal of this video was never "how to make Reddit videos for profit", but instead to explore the learning process behind automating with Python.
I don't want to discourage anyone from learning, but if your sole objective is making money, this isn't it :)
I think the good part is the way around about UA-cam limitation using Selenium. Another challenge you can solve with Selenium is accesing to content when is firewalled with Google Authentication or another authentication methods. It is possible but there is some extra steps needed.
Making money with youtube is always a moving target and it won't change.
Video like these are a gold mine of knowledge. Thanks for sharing.
Tiktok is diff
@@OZD_Collectivewell thats big news
Tnks
I didnt know tktk allow that and actually its easier then uploading to ytb as ytb has limits for using the free api
I was looking for new side projects to make money
@@ggre55 how'd it go?
Holy, this video is amazing?
It's kinda scary to see small content creators somehow nailing that "I've got millions of subscribers and countless hours of video editing" vibes in their videos... I don't know how to describe it, but your video reeks of professionalism, as if you've created videos on a regular basis
I'll start learning python right this instant, nothing can stop me now
How's the Python learning going?
@CS-ec7gl currently watching Bro Codes full 12 hour course to get acquainted with Python, I'm at "Write a File"
Not gonna lie, it's definitely a hefty amount of input and I gotta look up certain lines of code several times just to understand what's going on, but I'm making progress nonetheless
If you have other recommendations for learning Python then I'm all ears, every bit of advice is appreciated!
How do you know he doesn't have hundreds of channels? xD
yeah this is not hard go for it dude
@@akshayy_xd this is hard for me and i really want to do this
As a Python hobbyist thats climbing out of the beginner stage to the intermediate stage, this video is awesome. I hope you do more! I'll be here to watch them :)
How long have you been studying Python?
I have 3 or 4 channels running with this kind of python videos (other topics in other ways), and I win money from 2 of them. Yes, it is good at it sounds.
But what I want to say you is I'm a beginner, I'm struggling with functions, so my "quality" is poor, but I made usefull and anti bug scripts that made money, the dificulty here is all that isn't python. Idea, niche, a way how the script will do all, find libraries, apply, praying god for stackoverflow having the solution (XD). But this can be done being a python begginer, you just need creativity
@@doeverything15 would you be cool with sharing the code for the python videos?
There are few channels which have the same video.... but the way you broke it down, step by step, line by line
You legend just got a lifetime subscriber!!!
The difference between someone who has done real things, and those who just make videos on UA-cam could be experienced in this video. excellent work.
Keep this content coming my dude! Excellent work with the storyline 🙌🏼
Wow, My mind is blown, because i absolutely have no idea what you said; as I'm watching it at 1.75x but it sounds super fun. Will come back later or will have to watch a few million times before I understand.
But trust me it was fun watching!!
This proves an ethical concept I want to do but with Moviepy mainly
im a python student , learning for less than a year . THIS IS AMAZING
Sweet, I was just thinking about making an automated UA-cam channel! Now that I know it's definitely possible, I no longer have to try! Thanks for saving me the work!
Damn it i loved how you explained everything step by step. Got a new subscriber!
Took your idea as inspiration and started coding my own tiktok video „generator“ my code can already screenshot posts and comments and generate mp4 files for the tts!
Thanks for this great video man
What a way to start your channel! I'm looking forward to future videos that you might create. Subscribed.
You are now my favorite python UA-camr, please do more videos like this
that's the second time I'm looking the video, I believe this is one of the best video on python I saw
It's chill and clear, great job!
As a beginner that just finished his python course, this video was well made and explained. Good job!!
What course did you take?
This video is amazing, I would love to see more videos by you in the future!
I'm really sure that most of these videos on Shorts, Instagram and TikTok are made in a similar way, it's pretty frustrating to see that they get magnitudes more of views compared to us small creators who put a lot of effort in our videos.
Really love your content, can you make more videos on automation using selenium? People go over the practical stuff but they don't tell what really goes through the code. Thx :)
Remember that Veggietales clip where they joke about the future of entertainment being "randomly generated"
That clip has aged extremely well lmao
Amazing Video I loved it keep doing great things!
Great video!
Really liked how you explained everything on point maybe that’s the push I needed to get back to python 😅
It was a really nice video! Keep it up! I created the same script 7 months earlier when this reddit thing begin and I was curios how you achieved the same thing.
Very good animated video! I did kinda the same thing for a university project but we did it in C++ / Java. Will you make the code public in the future to look at it further in detail or was this just a show off and delete forever project?
Thank you! I'm planning on uploading the code to GitHub once I have a chance to clean it up/remove credentials/etc. I'll link it in the description in a few days
@@ShiftyTheDev Thank you very much, I appreciate it!
Repo link is now in the video description :)
Ahh I need to learn to do this. I have all the images and text for hundreds of shorts a month in Notion but can't find a no code api solution.
This is a wonderful vid, I was always wondering how they created those videos and you method would be the hardest but easiest long term. Still not interested in making videos like this but its cool that you can do stuff like this with Python!
How you explain it's perfect to learn! Subscribed!
That such an original idea. Crazy how no one has thought of that yet.
Very interesting. Subscribed. Pytjon is very flexible and automation is always something to invest time in. 15 hours of work is nothing if you can turn an idea into money.
This is what gets videos labeled as repetitious content. This is exactly what UA-cam doesn't want creators to do.
That's fair, this was more to explore how this could be fully-automated in Python. The source code I linked is just for reference, but I've had more than a few people expecting it to work out of the box, rather than learn from it. Thanks for watching!
not really if u can make these videos unique and can be done easily with ffmpeg
Completely agree. There is enough of this “content” on UA-cam already. Bad VR voice, canned, either stolen graphics or bad repetitive stock imagery and poorly written AI script. It's just spam.
@@moki123g if people skip it then it will get like 10 views. If it's interesting then people will keep watching.
@@moki123g its not spam if people like watching it, which based on the views numbers, they do.
Thanks man! This is fun and very useful information.
Great video! Maybe time to mess around with some machine learning in python and object recognition? Awesome video style.
Know nothing about code but this looks fun. Will try it out as soon as I know something.
yo did you figure it out? i am lost brother.
first video but it feels like you've been here forever. subbed!
Great job! You have mastered python at such a fast pace. Very well explained video too. May I know what app did you use to create this video? Seems wonderful with all those effects and visuals
Thank you! The visuals were all done with Vegas Pro. Ironically it was a very manual process to animate
this is similar to what i did for 300+ videos. I ran the bot for like a year maybe to only get 40k views total hahahah, i really had a hope for this. I can share a link to my repo but youtube clearly doesn't need more of these channels lol
You didnt do shorts and the videos are very long, that was your problem bro
Were you monetized
github link? Thanks
4:26 oh god... the comment
I genuinely forgot about that, glad someone noticed!
It would be nice to see an example. I used the text to speech package once but it just wasnt good. Arent there AI's one could use i dunno how the api works though
Source code is linked in the description if you wanna check that. The tts package definitely isn't the best, but all the nice AI voices I saw cost money to use
Love your explanations
i loved this! I can't get past making screenshots though. Probably because of the Mozilla updates and/or old versions of the webdriver. Didn't manage to fix it yet.
I like the final bit
Best part of the video honestly
How you do these smooth animations?😅
i like the editing and explain env , really apperciate it :) , new sub
you are so good!I really think this is a wonderful video!
Cracking Hard Work into Smart Work ... 👍👍👍
So surprised this hasn’t blown up yet
Great video! learned a lot, Thanks.
Damn, this is awesome. The video quality video too, even more impressive 😱 consider me inspired 😍
he explained it so well
cool!
Best video I’ve seen so far
Fireship caught in 1080p 😂
awesome project. keep up the great work
Very interesting video, keep it up. Subscribed!
Great video.
A small tip on an otherwise excellent code :
At 2:29 , instead of using "if A: continue" to filter out comments, better use "if not A : filter comments".
If you insist on using "if A", then at least use an else statment.
This is about the readability of your code, which in itself is good but also given your unusual situation where you show your code in a video is even more important.
Cheers.
YOU GONNA BOOM ON HERE BRO! GG
Amazing content, you got a sub 🔥🔥
i got it work it was pretty tedious you forgot to tell us how to name the video files and the to create directories. But i figured it out and got the code to work. took me a grand total of 3 hours to get to work. great script.
Hey do you remember what these extra steps were? I'm stuck now too, it prints out the top 4 posts and just loads infinitely after I choose one. I suspect I need to create folders like the BackgroundVideos and stuff. Thanks!
damn bro, i tried it from you github and it works great, but when selenium opens the firefox window, the reddit cookie banner pops up and im not logged in so its in german as default language. can i somehow circumvent that?
You could try something like this when it sets up the driver in reddit.py:
options = Options()
options.set_preference('intl.accept_languages', 'en-US')
browser = webdriver.Firefox(options=options)
did you solve it?
really nicely edited
love your voice btw. haha
Damn, just making the similar one in java, but with scrapping videos. Is ethical part so strong here? I mean if its not just a single screenshot, but a compilation of several funny\interesting things. When they gathered in one video for viewer's comfort, doesnt it change things?
I think there's a good argument for both sides of this. You could argue this serves the same purpose as a curator and gets the source material more traffic. Or you could argue it rips content to try and profit from it while requiring almost no work. At the end of the day, that's up to you.
Personally, I chose to stop posting these shorts because
1) Doesn't make money without a lot more work (something like 10M views before UA-cam pays you)
2) I'm not a huge fan of spamming the platform
3) Content ownership concerns (this is where you could argue if curation adds value)
4) Probably the biggest one, the goal of this project was always to learn from, not just as a tutorial for specifically how to automate Reddit shorts. It's already served its purpose to me
Sorry for the long comment, but I appreciate the conversation on the ethics of this. It's something I don't feel I covered enough in the video. Thanks for commenting :)
I don't know if UA-cam has changed their API since you made this video, but I had no issues uploading to youtube using it.
While i try to upload the video the open dialogue box was coming i am unable to automate that in UA-cam also i am not able to scroll on the show more options and no it is not made for kids like that can please tell me how to do that ? It will be useful. For some cases
Question... why parse Reddit? You have full text from the API. You could either a) Generate your own web page and screenshot that. b) Generate images with PIL.
You 100% could skip parsing Reddit if you wanted to. I chose to use Selenium since I was familiar with it, didn't want to mess with formatting my own screenshots, and figured it might be more interesting to talk about Selenium in the video. Great question!
Got it to work but I'm trying to make it scrape other subreddits, and have ran into a good amount of issues.. any ideas?
awesome! 🎉
Loving this make more vids
make a video explaining how you edit your videos like this one.. I beg you
This is amazing! What video editing software do you use?
This was made with Vegas Pro, but I'm looking into moving to Davinci Resolve 18
@@Bulliegh I've never tried it since I don't have a mac
how did you bypass reddits cookie notice ? you dont seem to be surpassing its shadow dom
Hello, you frogot to put the file 'Voiceovers/2024-04-17-1c5n97c-title.mp3' in the github repository
freat video but i have a small question how do you fix the login via google popup selenuim take a screenshot post but then the popup shows and it cannot take screenshots of the comments
For some reason, I can't make take screenshot of the posts or the comments. The audio file is fine though. Weird.
I don't think I've ever seen that with the UA-cam API. Perhaps it's because I always use it via an App ID created in the Google Cloud. What I do see is the upload limit which is loads if you do it via the interface (even if automated. During testing of a new upload method you'll hit it but it's like a months worth of daily videos for most channels) but about 6 or 7 videos a day if you do it via the API. Which makes batch uploading and scheduling more difficult.
"They give me bone pain"
Very nice, I wouldn't bother capturing actual screenshots - you've already got the JSON data, just render it yourself
Hello! First of all I love the video and explanation. But I'm finding myself stuck with the following error when it's trying to take a screenshot:
Traceback (most recent call last):
File "C:\Users\borut\Desktop\timmy\RedditVideoGenerator-master\RedditVideoGenerator-master\main.py", line 90, in
createVideo()
File "C:\Users\borut\Desktop\timmy\RedditVideoGenerator-master\RedditVideoGenerator-master\main.py", line 23, in createVideo
screenshot.getPostScreenshots(fileName, script)
File "C:\Users\borut\Desktop\timmy\RedditVideoGenerator-master\RedditVideoGenerator-master\screenshot.py", line 14, in getPostScreenshots
script.titleSCFile = __takeScreenshot(filePrefix, driver, wait)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\borut\Desktop\timmy\RedditVideoGenerator-master\RedditVideoGenerator-master\screenshot.py", line 21, in __takeScreenshot
search = wait.until(EC.presence_of_element_located((method, handle)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\borut\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\support\wait.py", line 95, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:187:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:505:5
element.find/
hey! did u fix it? I have the same problem...
good project and instructional
whats even more insane is that you can ask chat gpt to write all the code for you, i just did and im about to post the channel
Is there a way to make script go to the posts but no links when it's a link trhead?
Great Video!! Python just makes my life easier. I have a question: Are there copyright strikes for the reddit posts?
Really like the project idea
btw what software do you use to create for creating youtube videos
Thanks! I used Vegas Pro for this video, but have since switched to Davinci Resolve
@@ShiftyTheDev Thanks
Great video !!
Sorry that i got problem while using and would like to get a help.I am competely new to python and followed the guide in the zip file ,but it showed FileNotFoundError: [WinError 3] the system cannot find the path specified:'outputDir' .
I look it up on the internet,people said try to change the outputDir into the path of the file, however it is did not work.
I had struggo in it about few hours but still can't figure it out.
It's looking for a directory that doesn't exist then. If you can print out the path it's trying to output to, it may help your troubleshooting. Do note that it expects the outputDir to be in the root of the project
great video
The problem with this, you can not guarantee that the code will always works, posts can vary so much.
Amazing video! I just have one question. When you screenshot the div on reddit, you say the class = "Post'. I see the word "Post" in the class attribute of the div you are looking at but it is surrounded by a bunch of other gibberish that's probably unique to that specific post (something like: class="_1oQyIsiPHYt6nx7VOmd1sz _2rszc84L136gWQrkwH6IaM Post t3_18m8n51 "). How does your code still work even though the class is not equal to just "Post'"? I am getting NoSuchElementError errors.
HTML classes use a space as a delimiter, so searching for class "Post" should still get that element. Basically Selenium will treat that as a list of classes, and if any match it will return the element. I'm guessing the NoSuchElementError could be caused by the page still loading (I bumped into that issue a few times), so I'd try implementing waits and see if that helps
@@ShiftyTheDev Oh, gotcha! Thanks so much for the reply. My issue ended up being that the browser Selenium was opening up was providing different HTML than my regular browser, which is curious. I just had to change what I was looking for in the HTML. I'm not sure why this is the case, but hey, it works now, so I'm happy to proceed. Thanks again for your reply, it sent me down the right path. Again, amazing video!
bro Im not technical guy, can you help me to run this program, I change correctly reddit ID, argent, secret thing but still have error message suggests that the program is unable to find the specified directory 'OutputVideos' what do I need to do??
Create a directory called "OutputVideos" in the project
Hello! Your platform is really impressive. I'm wondering if you could provide me with the necessary code for uploading videos to monetized channels on UA-cam? The steps for doing so may differ from the usual process. Currently I have javascript code that uploads to normal channels(Channels without monetization enabled)
I am having trouble to make the python work from reference like screenshots and image clips . Too bad the author archived the discussion. Is anyone down to have a learning discussion about this?
I love the idea, if you don't mind could you please share the repo or codebase?
It's linked in the description, but is mostly for reference
we want more of this coding stuff
Do I consider it yes ;)
That is a yes :) A few projects already in the works
@@ShiftyTheDev gr8
Great informative video, very inspiring. (Also quite explosive in the hands of the morally corrupt, but information wants to be free, and the natural evolution of solutions are them turning into new problems, so what can you do). An empowering video. Now do how to beat lethargy next, plz. I'd love to get off my lazy a$$ and hone my new skill I just feel I got.
Hi bro, video awasome. Can we run this from local machine or need server? If local machine means how many hours laptop should ON.
Thanks! I'm a little confused by your question but his can run on any Python supported device. This may be helpful for understanding ua-cam.com/video/VXmvM2QtuMU/v-deo.html
The time this takes to run is about 2-3 minutes to generate a video, with most of that being render time
Hold on, 79 subscribers? What?? How? Am I ... one of the first?
I love videos about using automation and APIs to build cool stuff.
*80
Insane
In the config if i wanna add more subreddit how to add
Askreddit, Funnystory or
Ask reddit
Funnystory
how did you deal with the reddit cokkie banner, when i want to screenshot the comment, the banner is alsways overdisplay it
Microsft looking through the trash bin like...😅
how long did this take to learn? I do data science in Python, and I always like the idea of branching out to other areas with cool side-projects like this, but learning all the various libraries seems like so much effort.
It was surprisingly quick (the whole project took about 3 days), the slowest part for me was trying to learn MoviePy and get the video layout how I wanted it. I think projects like this are a lot more approachable if you only focus on the specific part of the library you need, but yeah it does take some effort
@@ShiftyTheDev sounds very cool. Will have to give it a go. Love the channel so far, as well. Looking forward to future videos.