I needed to do screen recording and upload videos to youtube multiple times in a day. I have been a python developer so i thought we need to automate the whole process of recording screen and then uploading video to youtube and so we did.
Please read the full article if you need the same.
Below we will see how to upload a video to youtube in just 10 lines of code. As we all know that youtube api have limit, which resists us to upload videos continuously on youtube. But we can use a browser based application which uploads video like human does. All we need to do is just calling simple functions and passing title, description etc.
Below are the detailed steps with code:-
- Install bot-studio
pip install bot-studio
2. Import bot-studio
3. Create youtube object, which will open automated chrome browser for youtube.
4. Now we will login to youtube in automated browser using cookies.
You can get cookies from Edit this Cookie Chrome Extension extension in simple steps:-
>Add this extension to chrome.
>Open youtube and log in.
>Click on extension icon, then click on export cookies.
>Now cookies will be copied to clipboard , replace list of cookies with these copied cookies.
5. Now we use the main function to upload video to youtube which returns video link of uploaded video.
7. Alternatively we can upload the video to a playlist as well.
Here is the full code:-