Python + YouTube API | Automating descriptions

Sdílet
Vložit
  • čas přidán 13. 09. 2024

Komentáře • 110

  • @FalseDev
    @FalseDev Před 3 lety +103

    Unrealistic, solving that error didn't take longer than the rest of the project!

    • @mCoding
      @mCoding  Před 3 lety +57

      Oh but it did! I just cut it all out so you didn't have to see :)

  • @john.dough.
    @john.dough. Před 3 lety +58

    this video had a much more fun theme than some of your other tutorials, and I really enjoyed it. Awesome work.

    • @mCoding
      @mCoding  Před 3 lety +14

      Awesome, thank you! I've been trying to make videos more fun :)

    • @BeefIngot
      @BeefIngot Před 3 lety

      I'd like more videos like this on the sort of silly but personally useful projects programmers get up to

  • @siddhantdeepful
    @siddhantdeepful Před 3 lety +24

    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

    • @mCoding
      @mCoding  Před 3 lety +9

      I definitely would have still done this even if I only used it once!

  • @jomy10-games
    @jomy10-games Před 2 lety +5

    “Why would I spend 15 minutes updating everything manually when I can spend 5 hours automating this?”
    That one is just too relatable

  • @dielaughing73
    @dielaughing73 Před 3 lety +11

    That subscriber count is starting to take off, James. Good to see!

    • @mCoding
      @mCoding  Před 3 lety +4

      Thanks! I think you're right!

  • @rvmishra9881
    @rvmishra9881 Před 3 lety +19

    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.!

    • @mCoding
      @mCoding  Před 3 lety +4

      I can't even explain why! ;)

    • @rvmishra9881
      @rvmishra9881 Před 3 lety +5

      @@mCoding May be because Repetitive Clicks are boring while writing new lines are not.!

  • @kirang1854
    @kirang1854 Před 3 lety +2

    This type of content is really useful for people learning how to work through common processes every python developer will face. Keep it up!

  • @azratosh
    @azratosh Před 3 lety +4

    Wonderful video as always. Also great to see how your production quality has improved!

    • @mCoding
      @mCoding  Před 3 lety +2

      Thank you very much! Glad to have you watching!

  • @fudgesauce
    @fudgesauce Před 3 lety +4

    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.

    • @mCoding
      @mCoding  Před 3 lety +3

      The secret is that is took way more than 5 hours, especially with recording and editing 😮

  • @norbyvevo4634
    @norbyvevo4634 Před 3 lety +10

    0:21 I call this a pro player move

    • @mCoding
      @mCoding  Před 3 lety +3

      Thank you, thank you.

  • @CodingDragon04
    @CodingDragon04 Před 3 lety +5

    love the 3blue1brown video's in your recommended feed!

    • @mCoding
      @mCoding  Před 3 lety +3

      He's one of my favorite creators as well!

  • @frankvega7801
    @frankvega7801 Před 2 lety

    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!

  • @astropgn
    @astropgn Před 2 lety +1

    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.

  • @yohannboniface3771
    @yohannboniface3771 Před 3 lety +6

    Let me use the youtube api to like all your videos ! Oh wait, they all already are :P

    • @mCoding
      @mCoding  Před 3 lety +3

      Taking bets on how quickly someone would get banned for doing this!!

    • @yohannboniface3771
      @yohannboniface3771 Před 3 lety +1

      @@mCoding Cant be banned for a such beautiful action, right ?

    • @john.dough.
      @john.dough. Před 3 lety

      ​@@yohannboniface3771 no good deed goes unpunished

  • @PestOnYT
    @PestOnYT Před 3 lety +2

    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!

    • @mCoding
      @mCoding  Před 3 lety +2

      You are absolutely welcome! I had a hard time getting started but hopefully for you and others it will be much easier!

  • @malayparmar504
    @malayparmar504 Před 3 lety +5

    Whenever I feel I know enough Python, I see your videos and after that I feel like I know nothing😅

    • @mCoding
      @mCoding  Před 3 lety +4

      Keep watching and you will get there! Thanks for watching!

  • @user-he4ef9br7z
    @user-he4ef9br7z Před 3 lety +15

    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
      @mCoding  Před 3 lety +6

      Then you understand the struggle of hoop jumping to get access :)

    • @user-he4ef9br7z
      @user-he4ef9br7z Před 3 lety +9

      @@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.

  • @barkgj
    @barkgj Před 2 lety +1

    Great humor, keep those vids coming!

  • @NateROCKS112
    @NateROCKS112 Před 3 lety +5

    0:20 but hey, at least you got a video out of it... though the editing probably took another 5 hours lol.

    • @mCoding
      @mCoding  Před 3 lety +8

      Yeah the editing is the worst part. Maybe i should spend 300 hours automating it...

  • @GameinTheSkin
    @GameinTheSkin Před 3 lety +1

    There is something about the deadpan humor on this channel that makes me feel fuzzy and queesy

  • @phuctran25277
    @phuctran25277 Před 3 lety +1

    Wow I really like the new music you added.

    • @mCoding
      @mCoding  Před 3 lety +1

      Thanks! It definitely adds some new flare!

  • @crazycorg1
    @crazycorg1 Před 3 lety +1

    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

  • @lazarinastoy
    @lazarinastoy Před 2 lety +1

    Love this tutorial, thank you James!

  • @ivanmclennon
    @ivanmclennon Před 3 lety +1

    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...

  • @Orincaby
    @Orincaby Před 3 lety +6

    cool video man! keep it up.

    • @mCoding
      @mCoding  Před 3 lety +2

      Appreciate it! Thanks for watching, and, of course, slapping that like button!

  • @user-he4ef9br7z
    @user-he4ef9br7z Před 3 lety

    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'.

    • @mCoding
      @mCoding  Před 3 lety +1

      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.

  • @confern
    @confern Před 3 lety +1

    CZcams does already have a feature like this, but your version is better as you can modify anything you want

    • @mCoding
      @mCoding  Před 3 lety +2

      Cool, I didn't know CZcams already had a similar feature!

  • @jemand771
    @jemand771 Před 3 lety +1

    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

    • @astropgn
      @astropgn Před 2 lety

      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.

  • @codingcrashkurse6429
    @codingcrashkurse6429 Před 3 lety +2

    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.

    • @mCoding
      @mCoding  Před 3 lety +2

      Very cool! I am fortunate that I get basically no spam on my videos. (Thank you to my awesome viewers)

    • @codingcrashkurse6429
      @codingcrashkurse6429 Před 3 lety +1

      @@mCoding My viewers are awesome too, these spam came from bots, but the problem seemed to be solved by YT some time ago luckily :)

    • @mCoding
      @mCoding  Před 3 lety

      Fair enough!

  • @harumambaru
    @harumambaru Před 3 lety +1

    Hats off for "Why spend 15 minutes updating everything manually when I could spend 5 hours automating it?"

  • @pymust
    @pymust Před rokem

    You helped me a lot!

  • @mme725
    @mme725 Před 2 lety

    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?

    • @mCoding
      @mCoding  Před 2 lety

      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!

  • @funkenjoyer
    @funkenjoyer Před 3 lety +1

    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

    • @mCoding
      @mCoding  Před 3 lety

      Good to know 👍. I'm glad nothing I was doing needed verification.

  • @FarsansTorraOrdvitsar

    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
    [***]

  • @emifro
    @emifro Před 3 lety

    0:27 That is so relatable

  • @ncs6387
    @ncs6387 Před 3 lety +1

    All of my videos in my channel were made by Python (including song downloads, video editing, video uploading, youtube data analysis)

  • @jolynele2587
    @jolynele2587 Před 3 lety +9

    why spend 20 mins updating manually when you can go through 14 hours of coding debugging and crying

    • @mCoding
      @mCoding  Před 3 lety +8

      This is how programmers work through their feelings.

  • @codergeek4625
    @codergeek4625 Před 3 lety +1

    amazing video . looks very complex lol.... I am just a beginner .

    • @mCoding
      @mCoding  Před 3 lety +1

      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!

    • @codergeek4625
      @codergeek4625 Před 3 lety

      @@mCoding yeah. thanks

  • @MEGATestberichte
    @MEGATestberichte Před 2 lety

    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.

    • @mCoding
      @mCoding  Před 2 lety +1

      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.

    • @MEGATestberichte
      @MEGATestberichte Před 2 lety

      @@mCoding Thank you very much :)

  • @gustavobertocco554
    @gustavobertocco554 Před 3 lety +1

    Amazing content! Could you bring something about .cu files and solving problems like MonteCarlo on GPU???? would be nasty!

    • @mCoding
      @mCoding  Před 3 lety +2

      I've been planning some GPU stuff forever! It's so technical and I'm trying to get it right.

  • @snoopyjc
    @snoopyjc Před 2 lety +1

    Next trick: use Selenium to automate the manual authentication steps

  • @maucon13
    @maucon13 Před 3 lety

    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).

    • @mCoding
      @mCoding  Před 3 lety +1

      I will eventually add support for this (refresh tokens) when I see a good example! For now though I don't mind :)

  • @yc691
    @yc691 Před 3 lety +1

    great vid!

    • @mCoding
      @mCoding  Před 3 lety

      Thank you! I appreciate your support!

  • @tehseensajjad1003
    @tehseensajjad1003 Před 3 lety +1

    what font are you using?
    Jetbrains mono?

    • @mCoding
      @mCoding  Před 3 lety +2

      Bingo! (It's the default PyCharm font for others who didn't know what Tehseen meant!)

    • @tehseensajjad1003
      @tehseensajjad1003 Před 3 lety

      @@mCoding looks so clean, ive been using the shitty source code pro font, switching over to jetbrains now, thanks

  • @amrooeldmohi6970
    @amrooeldmohi6970 Před 2 lety

    this is a good video ..... i want to know how to set pycharm to find like button in youtube and click it??

  • @waterfallsroadtripsjohnojdana

    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?

    • @waterfallsroadtripsjohnojdana
      @waterfallsroadtripsjohnojdana Před rokem

      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.

  • @vedsaga
    @vedsaga Před 3 lety +1

    Can you please make intermidate tutorials or some sort of guide for intermediate Python programmer...

    • @mCoding
      @mCoding  Před 3 lety

      Sure! If you have any suggestions about what topics, come drop them in Discord!

  • @FarsansTorraOrdvitsar

    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...

    • @mCoding
      @mCoding  Před rokem

      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.

    • @FarsansTorraOrdvitsar
      @FarsansTorraOrdvitsar Před rokem

      @@mCoding Already using the scope
      'force-ssl' wich should give the highest possible perms.. 😖

  • @skarfie123
    @skarfie123 Před 3 lety +1

    your chapters don't seem to be showing

    • @mCoding
      @mCoding  Před 3 lety

      Anyone know how to fix this? I did everything in the help article.

    • @skarfie123
      @skarfie123 Před 3 lety +2

      @@mCoding could it be the extra leading zeros?

    • @mCoding
      @mCoding  Před 3 lety +3

      @@skarfie123 Confirmed, leading zeros were the problem.

  • @crypto_peng
    @crypto_peng Před 3 lety

    AWESOME!

  • @stevenalexander6262
    @stevenalexander6262 Před 3 lety +4

    WOO IM FIRST

    • @mCoding
      @mCoding  Před 3 lety +5

      Please take this award!

  • @AnyFactor
    @AnyFactor Před 3 lety +2

    CZcams API or the Google cloud api is annoyingly complex to set up.

    • @mCoding
      @mCoding  Před 3 lety +1

      You don't have to tell me!

  • @finsflexin
    @finsflexin Před 2 lety +1

    Real men makes uses command line curl requests to the database instead of using API.

  • @TheChemicalWorkshop
    @TheChemicalWorkshop Před 3 lety

    i hate the youtube api and the oauth2 makes it worse more difficult and spaghetti...

    • @mCoding
      @mCoding  Před 3 lety +1

      I think if you only want read operations on publicly available information, you can use an API key instead of OAuth!

    • @user-he4ef9br7z
      @user-he4ef9br7z Před 3 lety

      You don't need oauth2 for public data. They give you a key.