Remember when YouTube used to have a built-in playlist that automatically grouped all your subscriptions’ new videos in one convenient place, allowing you to hit play once and watch all the new content as it was published? Yeah, those were the days…. Now we have a company that seems to be in an adversarial relationship with not only its casual users, but also some of its biggest content creators–a company that seems to want to remove useful options in the name of “progress” (as seems to be a consistent refrain from Menlo Park to Cupertino). Apparently, though, I am not alone for there is a lot of chatter about how to automatically add YouTube subscriptions to a playlist. It seems to be a feature that the users miss, but–thankfully–there are a few civic-minded hackers out there that put a little Google Fu to good use.
Benjamin Worrel found the beginnings of an answer while trawling Reddit for any insights on the problem (I originally found the same post he references in his write-up) in the form of a rudimentary Google Apps script that he then took and improved upon. The idea is that the script scrapes your Gmail inbox for notifications of new videos from your subscriptions, then adds the video to a specific playlist on YouTube (but not the sacred “Watch Later” list, YouTube doesn’t allow you to play with that one!).
To use the script, download a copy (link on this page) to your Google Drive, then follow the instructions in the commented lines of your copy of the script. Start by ensuring that Google Advanced Services is enabled for your account by clicking on the “Resources” menu and selecting “Google Advanced Services”. In the window that pops up, click the toggle next to “YouTube Data API” and make sure it’s on. Then click the “Google Developer’s Console” link to open the API manager and enable the YouTube Data API as there as well. You may now close the Developer’s Console tab as well as the Advanced Services window.
In a separate tab, create a new YouTube playlist, copy the ID from the URL (That’s the long string of characters at the end. You’ll see an example in the script’s comments), and paste it inside the pair of single quotes next to
Personally, I don’t use the “clear old videos” option, so I commented it out with a pair of forward slashes (
//). I also don’t want live stream announcements (because I’m usually not around to watch them anyway), so I leave that as true. My subscriptions run the gamut of short to long, so I just comment out the time restrictions as well.
After playing around with the settings and results, I noticed that I was getting a lot of duplicates showing up in my playlist, so I tracked it down to the search query. Leave the line that reads
emailQueries.push('from:"firstname.lastname@example.org" subject:"uploaded a video"');
while commenting out the one that reads
emailQueries.push('from:"email@example.com" subject:"new videos from"');.
This will help cut down on the duplicates. I also made filters that automatically deleted any emails that weren’t specifically notifying me of a uploaded video (such as live streams and “reminders to watch”) which has also drastically reduced the duplicates I get as well.
You’ll also likely want to keep a log just in case something breaks. In a new tab, open Google Drive and create a new spreadsheet. Copy the document ID from the URL (just like your playlist) and paste it between the single quotes next to
One last bit of code to change: search for the commented line that reads “
// mark the email read and archive it” and below that, change the command
Finally, we’re ready to run the script. Click the “Run” menu, then select each of the items to run them once. You will need to grant the appropriate permissions as requested for the script to function correctly. By default, the script will run, server-side, every hour, but that can be changed by adjusting the
.everyhours() value inside the
AddTrigger function. Of course, you also need to turn on notifications for all your subscriptions and make sure that you are emailed when new videos upload.
The script still has a few flaws in it, like not automatically removing watched videos and occasionally adding duplicate videos to the list, but it is so much easier to click an X to remove a few errant videos than it is to go through and click “Watch Later” on piles of backlogged Game Grumps and Channel Awesome videos!
For more information on this script and to get started by copying it to your Google Drive, please visit Benjamin Worrel’s website.Also on: