There is something about the feeling you get for automating a task you know that at most 5 people will actually need and still spend hours writing code just to use it once
I think the best part of this video is you saying it took five hours to come up to speed, do some careful trial runs, then doing it. All too often I see people posting things like "I had a couple free hours so I wrote a C++ compiler." Either they are gods or they are fudging.
Great stuff! I've just done this on Google Sheets + Google Script, took me 8 hours and no fallback or any of the safety measures you implemented. Keep up the good work!
One thing that wasn't mentioned in this video, but anyone working with google's api will eventually know: There are variable costs (of free credit) for using the api. You get a monthly quota, and each request has a weight depending on what it does. Retrieving public information from videos is cheap (1 credit or something). But getting private info or rewriting info (like what he did in this video) has a higher cost (50). Upload a video is also possible, but it costs 1600. So you have to "budget" your credits if you want to make a big project.
I was just using the youtube data api minutes ago. Yep they're pretty serious about rules. I got all of my projects removed for a month ... twice. Because I was doing stuff I should not have been doing 🤣🤣
@@mCoding What was I thinking? I needed to filter through a huuuge amount of data and the daily quota wasn't enough. So I set up a bunch of projects and used multiple api keys. In a few moments, they gave me an email and suspended all projects I had. I tried again using another tactic, they caught me again. I had to delete all my projects and wait for a month to set up a new one. Regained access yesterday. Thank God I'm not a professional, just a kid fooling around with his computer. If anybody is reading this, DO NOT TRY TO BYPASS API QUOTAS, THEY WILL CATCH YOU. I just got a question. Isn't the python module for the youtube data api too slow? How do you get asynchronous support? Threading doesn't work, they cut you off if you try that. I resort to using fstrings with aiohttp.
shame this video didnt come out a bit earlier, at the time i was trying the YT api myself to do some things with my watch later playlist. the problem is, google doesn't give you programmatical access to that playlist anymore...
For anyone reading this, you don't need to use a request to get your uploads playlist Id, just get your channel id and replace the 'UC' at the beginning with 'UU'.
If you really want to save that 1 quota :). Note that this requires hard-coding the channel id or playlist id, so the app would be specific to one CZcams account. The approach I took uses the API to get the channel info of the currently logged in user.
theres also an easier to use 3rd party python client for the youtube api. for example, you can just tell it to give you all elements so you don't need to worry about pagination - it does that silently in the background
Yeah, python has a lot of wrappers out there. Yesterday I saw a library that was made just to do the exact same thing as datatime, but differently., because they didn't like how datetime worked, idk... But in all honesty, dealing with google's apis is very straightforward. They are complex at first but you get used to it, and after you learn how to work with this little things like pagination, it becomes easy. Depending on what you want to do, it might be more practical to just work directly with the api. The same goes for twitter. A lot of people use tweepy, which works great. But there are still things you cannot do with it, but it is possible to do if you use twitter's api directly.
You can do some cool stuff with the YT API. I used it in my company to create training data for a Chatbot by downloading the subscriptions of tons of videos. Personally I used it to delete spam comments :-D.
just saw this video now, and saw there were a bunch of interesting videos I haven't seen from you yet! Particularly the Doeblin Tree video that gave you the metadata/tags problem near the end. I can't seem to find many of these videos in your channel now though, did you privatize them or remove them? Or is youtube being particularly weird and not showing me all your uploads?
automating yt with api is cool, the only problem i have with it is that u need to verify the api to upload non private videos and i realised that after already making my script, when i checked the verification form i just noped out of it :P
In my videos I am planning to use links to other stuff (playlist etc). So thought of doing something like; Links: Link1 Link2 Link3 [***] Then I can use the place holder when extending the comments in my videos: placeholder = '[***]' current_description = snippet['description'] new_link = 'Link4' updated_description = current_description.replace(placeholder, f"{new_link} {placeholder} ") To make it look like: Links: Link1 Link2 Link3 Link4 [***]
It's okay if you're a beginner! Sometimes its fun to just sit back and see what *can* be done. Maybe you'll get some ideas for a simpler project you might be able to do!
Whats interesting is that if i update the descripting using the api, the new description shows up on the public page. If i then lick edit video, the for mhas the old description in it. Weird.
I actually ran into this issue too! This is a bug/feature in youtube studio. You will find your descriptions updated in your private view within 24 hours.
You dont have to authenticate yourself everytime. You can cache the authentication as an object and reload it when needed (need to redo every 7 days tho).
Great work. Thank you. When I run this it only goes to video 499. I wonder if there is a hard stop at 500. I have more videos posted than that. I would like to be able to see and manipulate all of them. Any ideas?
I modified the paginator function and it downloaded all of them. "def paginated_results(youtube_listable_resource, list_request, limit_requests=100) -> Iterator:" Changed 10 to 100. Perhaps they have changed their 50 limit.
I believe youtube updated the required permissions and some of the actions in this video that used to require lower permissions such as readonly now require more. Not sure which perms specifically but i vaguely recall doing getting a similar error recently that i fixed by increasing the requested perms.
Unrealistic, solving that error didn't take longer than the rest of the project!
Oh but it did! I just cut it all out so you didn't have to see :)
this video had a much more fun theme than some of your other tutorials, and I really enjoyed it. Awesome work.
Awesome, thank you! I've been trying to make videos more fun :)
I'd like more videos like this on the sort of silly but personally useful projects programmers get up to
There is something about the feeling you get for automating a task you know that at most 5 people will actually need and still spend hours writing code just to use it once
I definitely would have still done this even if I only used it once!
“Why would I spend 15 minutes updating everything manually when I can spend 5 hours automating this?”
That one is just too relatable
That subscriber count is starting to take off, James. Good to see!
Thanks! I think you're right!
Why spending 15 or so minutes updating everything manually when I could spend 5 hours automating it?
This is exactly something that I love to do.!
I can't even explain why! ;)
@@mCoding May be because Repetitive Clicks are boring while writing new lines are not.!
This type of content is really useful for people learning how to work through common processes every python developer will face. Keep it up!
Glad to hear that!
Wonderful video as always. Also great to see how your production quality has improved!
Thank you very much! Glad to have you watching!
I think the best part of this video is you saying it took five hours to come up to speed, do some careful trial runs, then doing it.
All too often I see people posting things like "I had a couple free hours so I wrote a C++ compiler." Either they are gods or they are fudging.
The secret is that is took way more than 5 hours, especially with recording and editing 😮
0:21 I call this a pro player move
Thank you, thank you.
love the 3blue1brown video's in your recommended feed!
He's one of my favorite creators as well!
Great stuff!
I've just done this on Google Sheets + Google Script, took me 8 hours and no fallback or any of the safety measures you implemented.
Keep up the good work!
One thing that wasn't mentioned in this video, but anyone working with google's api will eventually know: There are variable costs (of free credit) for using the api. You get a monthly quota, and each request has a weight depending on what it does. Retrieving public information from videos is cheap (1 credit or something). But getting private info or rewriting info (like what he did in this video) has a higher cost (50). Upload a video is also possible, but it costs 1600. So you have to "budget" your credits if you want to make a big project.
Let me use the youtube api to like all your videos ! Oh wait, they all already are :P
Taking bets on how quickly someone would get banned for doing this!!
@@mCoding Cant be banned for a such beautiful action, right ?
@@yohannboniface3771 no good deed goes unpunished
I wish there was such a good introduction to Google Home / Assistant API. I found only a lot of meta discussions no real code. Thanks for this video!
You are absolutely welcome! I had a hard time getting started but hopefully for you and others it will be much easier!
Whenever I feel I know enough Python, I see your videos and after that I feel like I know nothing😅
Keep watching and you will get there! Thanks for watching!
I was just using the youtube data api minutes ago. Yep they're pretty serious about rules. I got all of my projects removed for a month ... twice. Because I was doing stuff I should not have been doing 🤣🤣
Then you understand the struggle of hoop jumping to get access :)
@@mCoding What was I thinking?
I needed to filter through a huuuge amount of data and the daily quota wasn't enough. So I set up a bunch of projects and used multiple api keys. In a few moments, they gave me an email and suspended all projects I had. I tried again using another tactic, they caught me again. I had to delete all my projects and wait for a month to set up a new one. Regained access yesterday. Thank God I'm not a professional, just a kid fooling around with his computer. If anybody is reading this, DO NOT TRY TO BYPASS API QUOTAS, THEY WILL CATCH YOU.
I just got a question. Isn't the python module for the youtube data api too slow? How do you get asynchronous support? Threading doesn't work, they cut you off if you try that. I resort to using fstrings with aiohttp.
Great humor, keep those vids coming!
0:20 but hey, at least you got a video out of it... though the editing probably took another 5 hours lol.
Yeah the editing is the worst part. Maybe i should spend 300 hours automating it...
There is something about the deadpan humor on this channel that makes me feel fuzzy and queesy
Wow I really like the new music you added.
Thanks! It definitely adds some new flare!
Instead of doing my 30 minutes of online vocabulary homework ever week I spent an entire week coding something that does it automatically for me
Love this tutorial, thank you James!
Glad you enjoyed!
shame this video didnt come out a bit earlier, at the time i was trying the YT api myself to do some things with my watch later playlist. the problem is, google doesn't give you programmatical access to that playlist anymore...
cool video man! keep it up.
Appreciate it! Thanks for watching, and, of course, slapping that like button!
For anyone reading this, you don't need to use a request to get your uploads playlist Id, just get your channel id and replace the 'UC' at the beginning with 'UU'.
If you really want to save that 1 quota :). Note that this requires hard-coding the channel id or playlist id, so the app would be specific to one CZcams account. The approach I took uses the API to get the channel info of the currently logged in user.
CZcams does already have a feature like this, but your version is better as you can modify anything you want
Cool, I didn't know CZcams already had a similar feature!
theres also an easier to use 3rd party python client for the youtube api. for example, you can just tell it to give you all elements so you don't need to worry about pagination - it does that silently in the background
Yeah, python has a lot of wrappers out there. Yesterday I saw a library that was made just to do the exact same thing as datatime, but differently., because they didn't like how datetime worked, idk...
But in all honesty, dealing with google's apis is very straightforward. They are complex at first but you get used to it, and after you learn how to work with this little things like pagination, it becomes easy. Depending on what you want to do, it might be more practical to just work directly with the api.
The same goes for twitter. A lot of people use tweepy, which works great. But there are still things you cannot do with it, but it is possible to do if you use twitter's api directly.
You can do some cool stuff with the YT API. I used it in my company to create training data for a Chatbot by downloading the subscriptions of tons of videos. Personally I used it to delete spam comments :-D.
Very cool! I am fortunate that I get basically no spam on my videos. (Thank you to my awesome viewers)
@@mCoding My viewers are awesome too, these spam came from bots, but the problem seemed to be solved by YT some time ago luckily :)
Fair enough!
Hats off for "Why spend 15 minutes updating everything manually when I could spend 5 hours automating it?"
You helped me a lot!
just saw this video now, and saw there were a bunch of interesting videos I haven't seen from you yet! Particularly the Doeblin Tree video that gave you the metadata/tags problem near the end. I can't seem to find many of these videos in your channel now though, did you privatize them or remove them? Or is youtube being particularly weird and not showing me all your uploads?
I unlisted a bunch of videos that were old when i had a bad microphone and camera. You can still see all of them on github!
automating yt with api is cool, the only problem i have with it is that u need to verify the api to upload non private videos and i realised that after already making my script, when i checked the verification form i just noped out of it :P
Good to know 👍. I'm glad nothing I was doing needed verification.
In my videos I am planning to use links to other stuff (playlist etc).
So thought of doing something like;
Links:
Link1
Link2
Link3
[***]
Then I can use the place holder when extending the comments in my videos:
placeholder = '[***]'
current_description = snippet['description']
new_link = 'Link4'
updated_description = current_description.replace(placeholder, f"{new_link}
{placeholder}
")
To make it look like:
Links:
Link1
Link2
Link3
Link4
[***]
0:27 That is so relatable
All of my videos in my channel were made by Python (including song downloads, video editing, video uploading, youtube data analysis)
why spend 20 mins updating manually when you can go through 14 hours of coding debugging and crying
This is how programmers work through their feelings.
amazing video . looks very complex lol.... I am just a beginner .
It's okay if you're a beginner! Sometimes its fun to just sit back and see what *can* be done. Maybe you'll get some ideas for a simpler project you might be able to do!
@@mCoding yeah. thanks
Whats interesting is that if i update the descripting using the api, the new description shows up on the public page. If i then lick edit video, the for mhas the old description in it. Weird.
I actually ran into this issue too! This is a bug/feature in youtube studio. You will find your descriptions updated in your private view within 24 hours.
@@mCoding Thank you very much :)
Amazing content! Could you bring something about .cu files and solving problems like MonteCarlo on GPU???? would be nasty!
I've been planning some GPU stuff forever! It's so technical and I'm trying to get it right.
Next trick: use Selenium to automate the manual authentication steps
You dont have to authenticate yourself everytime. You can cache the authentication as an object and reload it when needed (need to redo every 7 days tho).
I will eventually add support for this (refresh tokens) when I see a good example! For now though I don't mind :)
great vid!
Thank you! I appreciate your support!
what font are you using?
Jetbrains mono?
Bingo! (It's the default PyCharm font for others who didn't know what Tehseen meant!)
@@mCoding looks so clean, ive been using the shitty source code pro font, switching over to jetbrains now, thanks
this is a good video ..... i want to know how to set pycharm to find like button in youtube and click it??
Great work. Thank you. When I run this it only goes to video 499. I wonder if there is a hard stop at 500. I have more videos posted than that. I would like to be able to see and manipulate all of them. Any ideas?
I modified the paginator function and it downloaded all of them. "def paginated_results(youtube_listable_resource, list_request, limit_requests=100) -> Iterator:" Changed 10 to 100. Perhaps they have changed their 50 limit.
Can you please make intermidate tutorials or some sort of guide for intermediate Python programmer...
Sure! If you have any suggestions about what topics, come drop them in Discord!
I'm just getting 403 when updating my video description...
...
response = request.execute()
snippet = response['items'][0]['snippet']
snippet['description'] = 'newDescr'
snippet['title'] = 'newTitle'
request = youtube.videos().update(
part="snippet",
body=dict(
id="my_video_id",
snippet=snippet
)
)
response = request.execute()
using oauth2 and scope set to forcessl..
Don't know why...
I believe youtube updated the required permissions and some of the actions in this video that used to require lower permissions such as readonly now require more. Not sure which perms specifically but i vaguely recall doing getting a similar error recently that i fixed by increasing the requested perms.
@@mCoding Already using the scope
'force-ssl' wich should give the highest possible perms.. 😖
your chapters don't seem to be showing
Anyone know how to fix this? I did everything in the help article.
@@mCoding could it be the extra leading zeros?
@@skarfie123 Confirmed, leading zeros were the problem.
AWESOME!
WOO IM FIRST
Please take this award!
CZcams API or the Google cloud api is annoyingly complex to set up.
You don't have to tell me!
Real men makes uses command line curl requests to the database instead of using API.
i hate the youtube api and the oauth2 makes it worse more difficult and spaghetti...
I think if you only want read operations on publicly available information, you can use an API key instead of OAuth!
You don't need oauth2 for public data. They give you a key.