Open the OpenAI Chat and ask to create a script for Google Apps Script, see my example: The result was this script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | function getLastUploadedVideo(channelId) { // Use the YouTube Data API to get information about the channel var channelResponse = YouTube.Channels.list('contentDetails', { id: channelId }); // Get the uploads playlist ID from the channel response var playlistId = channelResponse.items[0].contentDetails.relatedPlaylists.uploads; // Use the YouTube Data API to get information about the latest video in the uploads playlist var playlistResponse = YouTube.PlaylistItems.list('snippet', { playlistId: playlistId, maxResults: 1 }); // Get the video ID and title from the playlist response var videoId = playlistResponse.items[0].snippet.resourceId.videoId; var videoTitle = playlistResponse.items[0].snippet.title; // Return an object containing the video ID and title return { id: videoId, title: videoTitle }; } |
You need to create a Google Apps script or use a script from an older project, and it will ask for YouTube permissions. I need to change this source code with the… Read More »