Last active
February 26, 2018 22:36
-
-
Save rheajt/52278f561c86bdcbb6ec2e50a929b239 to your computer and use it in GitHub Desktop.
google apps script to update all youtube video descriptions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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