Automate Anything on YouTube: A Guide to API Integration with ChatGPT & Zapier | AI Tutorial β
Let's build with Zapier and AI (100+ videos)π
2023-08-17
Transcript β
[00:00] welcome back to webcafe here we do daily videos on artificial intelligence for your personal and business life in today's video we're going to do quite a special one we're going to show you how to access API calls with YouTube but don't worry we're going to walk you through the entire process we're going to show you basically how to do stuff that's not natively available in softwares like zapier or make and start doing more custom automations for your clients or for your business this is going to be a really really cool one as We Know YouTube is one of the largest networks for media content so leveraging its API documentation and doing anything
[00:31] we want when it comes to Ai and automation is going to be pretty powerful tool all right let's go ahead and jump in here we are going to be exploring all of YouTube's API documentation and in today's video we're going to show you how to take a video that's been uploaded and automatically change the title maybe a couple days later and if you want to try and test a different title in the future and see how to perform with YouTube's metrics let me know in the comments down below if you want to see more content like this where we do more custom work with API calls and stuff that isn't natively available in zapier and maybe your
[01:03] automation platform that you use in your backend for now though let's go ahead and do a new trigger here and we're going to go ahead and do YouTube and we're going to learn a bunch of stuff uh when it comes to API calls what to understand about them and so on we made a new video and channel so obviously the first step here is make sure whatever Channel you're doing this for you have access um to its API right so let's go ahead and grab the channel ID I'm going to come to our channel here and go ahead and just copy that little uh string of characters on the URL from here when it
[01:34] comes back over here hit continue and then we'll be able to find new videos found on our channel so we got one of our shorts videos here so originally when I was deciding to make this tutorial I was going to do an action of uploading a new thumbnail because as I was exploring the API documentation to YouTube and zapier earlier this year this wasn't an option but funny enough it seems like zappy went ahead and did it for us now so you can actually update a video thumbnail on YouTube if you wanted to do so this is helpful in the
[02:05] context of maybe making AI generated videos and you want to automatically upload a video thumbnail so you don't have to upload it manually so that's pretty cool idea I didn't know this was available on YouTube's back and I think this is a pretty new edition so once I ran into that I was like okay well seems like zapier allows us to natively do that let's go ahead and do something else with the API request so we're going to do API request here I'm gonna hit continue continue again and let's go ahead and jump over to YouTube's documentation typically when dealing with zapier and API calls
[02:36] they'll provide a link if they don't simply put in the software that you're looking to integrate with and just put an API documentation it'll take you directly to everything that is relevant for what we care about here so in today's video we plan on using this documentation to upload the title of the video because as you see here with our actions we aren't able to upload the title of the video we are only able to upload another video and upload a video thumbnail so from here it's going to jump back over here and we're going to go ahead and search through the documentation here but for us we know
[03:07] that we're looking essentially to upload or update the underlying video so we're gonna go to videos here and here's the option for update you can also use this little filter bar up here I think a lot of documentation has that some documentation is cleaner than others for this though we are here okay so there's going to be a lot of stuff when it comes to documentation that you need to understand right off the bat first thing you should understand is typically they'll have the type of HTTP requests right off the bat here so we come back over here as you see here
[03:38] um we got our URL here so we're going to grab the URL ignore that or actually don't ignore it but know that it's a put and what I mean by that essentially if you come over here it says HTTP method we have git patch delete post put just as a rule of thumb here to get is to receive data posted to push data and then put is typically around pushing data or sharing data between two different softwares from here though we can go ahead and put puts we're going to use the URL that it provides as you see here this is the put URL we're going to use it's going to be able to call upon the underlying video that we want to
[04:09] update obviously we're going to provide variables so it knows what video we're talking about here and that's going to proceed from here so the next step here is going to be understanding have a query string parameters and maybe known of and on top of that what specific action we're trying to do and call upon so we kind of scroll down here as you see there is going to be this right here so we want to do a snippet title we want to change the title of the YouTube video so we're going to choose the one that says title before we do that we got to make sure that we are covering all grounds here and what data is being requested so as you see here it says
[04:39] this example updates a specific video the ID snippet title and snippet category Ida properties are all required everything else is optional so what that means is that anytime we call upon this API we have to make sure that we include these three variables as you see here they even give a code example of this being used here so for example let's say well you know we're looking at category ID and we have no clue what that even means let's go ahead and figure out what that means by simply just clicking on category ID
[05:10] put in YouTube category ID and then as you see here we got a list of category IDs so if you come back over here um to see the code example it says 22 and that would be people in Vlogs so for our context we would be 27 education so that is going to be our category ID when we push this forward so now that we know that we understand the variables Associated and we understand that essentially we are going for a snippet title now we need to Proctor the underlying URL we are using
[05:42] in this context so to do so what we got to do is as you see a required parameter is part and then essentially an additional value to that is going to be one of these so for us we're doing a snippet as you see right here snippet title so I'm going to go ahead and do part copy that I'm going to paste part there I'm gonna come back over here um grab snippet put that in there and essentially what this is doing is this is putting part and snippet into the URL here but this is how they want us to structure it for
[06:12] zapier so we call upon that specific um API functions within this documentation so you see there's a bunch of different functions when it comes to snippet so the one we care about here is going to be title so now that we have set up exactly what we're targeting here now we get to our next phase here which is going to be authentication headers or included automatically so what that means for us is that we don't have to actually worry about authenticating our ability to even access the specific video we're about to access here do the fact that we've already connected with zapier's backend so there is there is
[06:43] going to be an issue of like do you even own the rights to have the ability to change the title of that channel in that context now the reason that comes into play and that's why that's even there is because of the fact that sometimes when you do these API requests maybe the app that's in zapier doesn't have an AP right request function or maybe the app you are integrating is not even you that natively in zapier so in that context you could use a web hook and you would essentially set up your additional request headers here but for this context we don't need to so let's go
[07:13] ahead and jump into the code and change our title just right after that so remember the data we're messing with here this is the shorts video we're messing with here we got what twitch is missing let's go live and make money with AI so before we add the code here let's go ahead and add a gbt block here and we're going to do an event of conversation continue and choose our account gbt continue I'm going to say based on this YouTube title your semicolon parentheses input
[07:45] our title here I'm going to say generate a new one that uses different keywords so this is just a quick example um so maybe the context is you want to change the title uh seven days from now because maybe it's not performing right maybe we call upon apis if the views are you know sub this amount then we change the title you know there's a bunch of complex stuff we can do here but for now I think this should be sufficient so I'm going to go ahead and up the model to gbt4 here and add a memory key
[08:20] add a memory key and I'm not even gonna lie right now for a second there my heart dropped because usually the memory key can be found down here um but they put it back they put it up UI wise up here so for a second there I was like oh my gosh zapier messed up so badly because I thought they removed that variable thankfully they didn't so it's gonna put YouTube title oh that would have been bad okay I'm gonna continue here I'm gonna test that action and if you don't know why I was freaked out that much memory keys are so fundamental when it comes to Automation and AI in general it allows for
[08:51] consistent outputs and scaling but from here we got our new title so I'm gonna go ahead and just format that a little actually one thing I want to do in order to ensure that we have no issues if we want to do this in reality if I'm add a parameter block here and say Max So in theory Max 100 characters but I like giving um a little bit less so that chat gbt doesn't actually overshoot it's gonna be uh Max 90 characters and hit continue here let's go ahead and test this action all right sweet so we got a new title here reformatted
[09:22] um let's not add a new action here let's go ahead and take this one obviously we're gonna go ahead and format out those quotation marks I'm gonna go do text and continue here you replace I'm gonna do an inputs and it's gonna be this output here I'm gonna find the quotation marks continue replace with empty space and then we should just get the title text there you go we got our title text that we can start using this is going to be the one that we push forward for the underlying video here so I could add a filter block here do some API calls to do the view count but for now I just
[09:54] really wanted to show you you know how to read documentation when it comes to YouTube and so on sort of do here is I'm gonna do it regardless you know this is going to incur so I'm going to add a delay block here no type of um no type of GPT block or some type of code that essentially says it has to be under this amount of views when you delay four and we'll just say you know seven days there we go so in seven days this YouTube title will update on this underlying video here so I'm gonna go ahead and grab the API call here let's
[10:24] add the code and send it forward so if you're not familiar of how to structure the underlying code use the example code understand it from the examples we go to C code examples and as you'll notice here essentially what is it requesting that's prevalent to what we care about we understand that it needs to category ID we understand that it needs the video ID and we understand that it needs the snippet title as seen with these three main variables here and as you see here the code seems to be formatted with brackets here so you know
[10:55] quotation mark quotation mark quotation mark quotation mark um what you'll notice is in within zapier's back end here we can actually uh do our formatting like this as you see here with Foo and bar it is completely valid within the documentation so I went ahead and set up the code already so what we need to do here essentially is we're going to give the video ID so it knows essentially what specific video we are targeting so I'm going to do ID here put in the ID here then we're calling upon the snippet function so we'll do the snippet and
[11:26] then what specifically within snippet are we calling upon is going to be the title so from here we're not gonna do AI for stream let's go ahead and input our formatted out output so we go to x that text formatter here there we go and then finally category ID if you remember we are education so I went ahead and put a 27 there and then this should be sufficient enough we should have enough information here to push this forward so I'm gonna go ahead and hit continue here and test the section there you go for a successful push you'll see this if you
[11:57] scroll down here there is no errors and then if we come over to our YouTube there we go it went ahead and updated our title as you see above me now in theory you could also update the description just be another API call uh but from here we have updated our video title to the specific one that we created through our a automation now one thing I want to point out is that you will run into errors typically when trying to do this kind of stuff because you're learning each api's documentation and really understanding the capabilities of each one so you run into areas we can do is you can scroll down
[12:28] here and when you get an error and an output it will essentially give one of these codes and a lot of times with one of these coaching kind of troubleshoot a little so if I got this code I could essentially be like okay the request metadata specifics and invalid scheduled publishing time and so on so that really helps with the troubleshooting on that end also just looking at their example code is really helpful in the sense of trying to achieve these kind of functions all right so I'm going to make sure to add that zap we just created today in the description down below let me know
[12:59] in the comments if you want more complex tutorials like this as you know unlocking you know the functions that are not native to zapier and start doing custom functions like these API calls he's going to really unlock the ability to do a ton of stuff when it comes to a Automation and really make AI integrate with everything possible on any software you use for any context I mean that's how powerful this stuff is getting now it just really comes down to are you able to do it that's the question
[13:29] um if you're familiar for bucket method you know writing down a list of manual tests that's typically associated with something or typically associate of your business you know how many of those can be automated what software is associated and so on if you feel like you learned something make sure to like the video it's completely free and it helps us your web Cafe AI if you want to learn more about zapier and automation AI check out the playlist at the end of this video so we're diving into all 5000 apps found on zapier's back-end make sure to subscribe for daily artificial content but without further Ado I'll see you in the next video thanks for tuning in NDS surprise I'm an
[14:03] AI Avatar make sure to explore more here at web Cafe where we demystify AI for your personal and business life until next time foreign