Automatically add new YouTube videos to your watch later playlist
A Google Apps Script for adding new videos uploaded by specific channels automatically to your watch later playlist.
There are a handful of YouTube creators whose videos I don’t like to miss out on. For me, those are Mark Rober, MKBHD, Matt D’Avella, MrBeast, TechLinked, Varitasium, Wendover Productions, Vox to name a few. Their videos are so high quality and fun to watch, that missing out on them feels not okay to me. That is why I made a Google Apps Script where all of the videos from these creators (as and when they upload) gets automatically added to my playlist (just like magic 😄). I can then go directly to the playlist and start watching videos whenever I am free without bothering to go searching for videos to watch.
Automation has become a big part of modern society. We see automation around us in businesses, factories, IT applications and even in our homes. They are convenient and makes the amount of your work less while getting the work done efficiently in the background. You just set them up once and you don’t have to bother about them again. The code below is a small part of automation that will make your life easier, but most of all it is fun to fiddle around with programming and making the computer do the work for us.
Below, I have mentioned how you can set specific channels whose videos will get added to your playlist automatically, whenever they upload. You don’t have to do any coding at all. I will soon release a post where I will explain the code and how you can build your own apps script.
How to get the automation working with no coding at all?
Copying the Google Sheet and the Code
Step 1: Head on to the “Channel Videos to Playlist” Google Sheet.
Step 2: Go to “File” > “Make a Copy”. This will make a copy of the Google Sheet and will save it in your Google Drive. Don’t just copy-paste the individual cells because there is a code in the Script Editor (see step 7 for more detail) which is essential for the automation to work.
Step 3: Enter your desired “File Name” and assign a “Folder” on your drive.
Editing the Google Sheet
Step 4: On the Google Sheet you just copied, you can edit or add more to the list in the “Main Sheet”. There is no limit.
Step 5: Find out the channel ids of any channel from the comment picker website.
Step 6: You don’t need to enter the “Last Video ID”, “Channel Name”. The script will find it out automatically (but you can if you want) based on the “channel id” you just entered in step 5.
Editing the code in Google Apps Script
Step 7: After all the channels are added, head on to “Tools” > “Script Editor”.
Step 8: On line number 4, edit the id between quotes to your “spreadsheet id”.
Step 9: On line number 5, edit the id between quotes to your “playlist id”.
Step 10: Run the code and give the necessary permissions. One of the permission will be to access the google sheet, accept it so that the code can access the list of channels. The other permission will be to edit your YouTube playlist which is required to add videos to your playlist.
Editing the triggers in Google Apps Script
Here you will tell the code to run every day on its own.
Step 11: In the left menu column, select “Triggers”.
Step 12: Select “Add Trigger” in the bottom right.
Step 13: Change “Select Event Source” to “Time-Driven”.
Step 14: Change “Select type of time based trigger” to “Day Timer”.
Step 15: That’s it! Click “Save”.
You can add/remove the channels as and when you want, it is not required to just do it on the first day.
Do note that the videos won’t get added to your playlist at the very instant the video is uploaded. The playlist only updates once each day as per the last image above. As we can see in the last image, the playlist gets updated only once every day and that will happen between midnight to 1 am. You can change the frequency if you wish, but keep in mind the Quotas for Google Services. If you have 15 channels on the list, then running the automation 4 times a day won’t be a problem (approximately). But more than that might give you errors. These errors will be sent to your email by Google. These errors are not a big issue because quotas are on day to day basis and hence the script will start running again from the next day.
Alternate methods from other developers
There is a Reddit post by Alighieri Dante which essentially does the same. It automatically adds new videos from your subscriptions to your watch later playlist (whose email notification is on). In his method, you don’t have to maintain a google sheet and put channel ids in it. You just subscribe to the channels you want and turn on their new video email notifications. Then the script will just pick up the emails from your inbox and add those videos to your playlist. It is simpler for some but for me, it isn’t because I don’t want to keep the subscriptions on (it is required if you want to turn on email notifications) of the channels whose videos are directly coming to my playlist. If the new videos are already in my playlist then I don’t want to see those videos again on the subscriptions page.
Now, grab a cup of coffee ☕ and start binging those YouTube videos! This script will run once every day. You will never miss your favourite creators’ videos ever again.
Get notified if and when the code gets updated.
thanks mate. been looking to do something like this for quite some time. you saved me the hassle of doing it myself. I tweaked it just a tad though. I added a PlayList ID in Column E so I can add videos to separate playlists and I reversed the order of which it checks videos:
for(var j=maxVideosToCheck-1;j>=0;j--)
So it adds them in chronological order (important for some channels). This makes the third page add videos much faster than intended and also makes lastVideoID much less useful. But it's manageable for now.
I really appreciate it.
Thank you, Tech angel!