Skip to content

Instantly share code, notes, and snippets.

@rheajt
Last active February 26, 2018 22:36
Show Gist options
  • Save rheajt/52278f561c86bdcbb6ec2e50a929b239 to your computer and use it in GitHub Desktop.
Save rheajt/52278f561c86bdcbb6ec2e50a929b239 to your computer and use it in GitHub Desktop.
google apps script to update all youtube video descriptions
function main() {
var videos = YouTube.Search.list('snippet', {
type: 'video',
maxResults: 50,
forMine: true
});
var allVideos = videos.items;
while(videos.nextPageToken) {
var videos = YouTube.Search.list('snippet', {
type: 'video',
maxResults: 50,
forMine: true,
pageToken: videos.nextPageToken
});
allVideos = allVideos.concat(videos.items);
}
for(var i = 0; i < allVideos.length; i++) {
var video = getVideo(allVideos[i].id.videoId);
updateDescription(video);
}
}
function getVideo(id) {
return YouTube.Videos.list('snippet', {id: id}).items[0];
}
function updateDescription(video) {
video.snippet.description = 'SUPPORT ME ON PATREON: https://patreon.com/jordanrhea \n\n' + video.snippet.description;
YouTube.Videos.update(video, 'snippet');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment