Old version! An updated one is here.
Setup and usage is simplified (now it is one script, doesn't use gmail anymore).
This is a Google Apps Script that automatically adds new Youtube videos to a playlist (a replacement for Youtube Collections feature). This is done through scraping the Youtube subscription notifications in a gmail label. (a workaround for the current lack of support for the main feature in both Youtube UI and API).
- Adds all new subscription videos to a Youtube playlist.
- Optional ability to set automatic interval for execution
- Optional ability to add only videos selected by a custom filter (e.g. videos from a particular users (e.g. videos of music), videos not yet customly filtered to other labels, etc.)
- Opt to receive youtube subscription notifications ("Send updates") to email
- Create a label in gmail (used exclusively for the youtube notifications, any name is fine, e.g.
youtube
) - Create a filter in gmail that adds a label (and perhaps preferably also skips inbox) to the youtube notifications (e.g. all emails
[email protected]
with a worduploaded
in the title)
- Copy both files to your drive: Document and Sheet
- Open the Script Editors (in menu:
Tools
/Script Editor...
) of both Sheet and Document and change the following variables:
var sheetId
(string in the URL of the Sheet between/d/
and/edit
)var docId
(string in the URL of the Document between/d/
and/edit
)var label
(text afterlabel:
in gmail search bar when the label is selected)var playlistId
(string in the URL of the Youtube Playlist after?list=
)
- Open the Script Editor of the sheet, then in menu:
Resources
/Advanced Google Services
/Google Developers Console
/Youtube API
/Enable API
- Open the Document and run
Functions
/getGmail
once and open the Document and runFunctions
/putYoutube
once to authorize access for the app.
- Create a Google Document (in Google Drive) and open it
- In menu:
Tools
/Script Editor
copy-paste the code fromdocScript.gs
in the repo - Create a Google Sheet (in Google Drive) and open it
- Add
false
toA1
of the Sheet - Open
Tools
/Script Editor
- Copy-paste the code from
sheetScript.gs
in the repo - Open the Script Editors (in menu:
Tools
/Script Editor
) of both Sheet and Document and change the following variables:
var sheetId
(string in the URL of the Sheet between/d/
and/edit
)var docId
(string in the URL of the Document between/d/
and/edit
)var label
(text afterlabel:
in gmail search bar when the label is selected)var playlistId
(string in the URL of the Youtube Playlist after?list=
)
Resources
/Advanced Google Services
-> Youtube Data API must be ONGoogle Developers Console
/Youtube API
/Enable API
- Open the Document and run
Functions
/getGmail
once and open the Socument and runFunctions
/putYoutube
once to authorize access for the app.
- Open the Google Document, then in menu:
Functions
/getGmail
- Open the Google Sheet, then in menu:
Functions
/putYoutube
For both Google Document and Google Sheet in their Script Editor
s:
- In menu:
Resources
/Current project triggers
getGmail
(orputYoutube
) ->Time driven
->Hour timer
->Every hour
Save
To remove all playlist items, bookmark the link below and click on it while having the youtube playlist page open.
javascript:(function() { if (confirm('Remove all?')) {var i = window.setInterval(function() {var closeButton = document.querySelector('.pl-video-edit-remove'); if (closeButton) { closeButton.click(); } else { window.clearInterval(i); }}, 500);}})();
(source)