#Social #Automation #Hack! Post a #Random #YouTube Channel’s Video to #LinkedIn #Facebook #Twitter

hi my name is jared dunn i’m chief liquidity officer for coindex labs and who are windex labs uh you can find our introductory video and a little short explainer on our uh on our um market maker and how to participate in our five-day trial in the link at the bottom of this video’s description um but today we’re going over a social automation hack that i just dreamed up i managed to use zapier and uh some python code to randomly select uh uh one of our youtube videos and uh post it to social networks so how do we do this well first you need an api key and you can google how to get your youtube api key from google then you need your channel id for the channel that you’re going to post and you can find that up here in most of the youtube links uh for that channel some of them have custom names if you manage to get enough followers or if you’re using a youtube channel that’s not yours that has enough followers and what does this look like in practice looks like this actually that’s not a good example let’s find my linkedin so i think it’s pronounced zap here v profile here’s one right here oops that’s not it this is a different post but i also automated using the same process uh so i have my youtube video and i have my youtube title and it’s been automatically posted to linkedin and that happens every so often so how do we do this well on zapier we create a news app we’re gonna make it triggered you may get triggered by anything but we’re gonna do a schedule so we can have it happen every day or every hour and the time of day we’ll do midnight for the court for the uh example here now what we’re going to do is we’re going to do code by zapier and we’re going to use this code so what does this do well he uses my api key and it finds my channel it looks up the results for that on the youtube api so let’s have a look at what that looks like on the internet so here’s what it looks like and i have my video id here which i can use to link the video which with uh the extra text here that we have the youtube.com slash watch v equals um then we have our title here which we’re going to use in our zaps so we get the results from that url we have an array for ids and array for titles by the way this long and short of this is that you want to copy the code that i put in the video description um into your zap and use that and replace your channel and replace your api key then we loop over the items in the results we look for if the video id is inside the data uh we save the video id we save the title we append the the title to the titles array and the ids the ids array along with the youtube link then we’re going to get a random number now the zap zapier interface supports requests library natively but it doesn’t support the random library natively so what we’re going to do is we’re going to use the request library to grab a random number off of random.org and what that looks like is this so we’re going to take the length of the ids array minus one so if it’s five long we’re gonna get random number from one to five like this from random.org and it generates a new number every time and then we’re gonna return the random youtube video and title so it’s going to look like this in our data and it’s going to be different uh it should be different every time see it generates a random number and chooses a random video so to do that in this app we’re going to use return here and we’re going to use all of this so we go back to zapier we do python code here because we’re running python code and we do next continue uh so we’re going to throw all of this code in here i’m going to continue we’ll be able to test it it’s going to give us some results that we get to person to our whoops back to setup i forgot to do my last step here it’s going to be a multi-step zap uh and if we wanted to post the twitter for instance we select twitter we would log into twitter i’m going to create a tweet with my twitter account and what we’re going to do is we’re going to grab the title from our run python zap and the link and we’re not going to shorten the url if i do continue here and then test it should have posted to my twitter a new tweet that’s a random video and that’s that we would then turn the the zap on and it would post that every day at midnight alright you might see this video randomly on my twitter and facebook and linkedin thanks bye