Thread with 3 posts

jump to expanded post
Starla , @[email protected]
(open profile)

Thanks to Google Apps Script and this project, this link now grabs a random SiIvaGunner video. And here's all the code I used to do it:

function doGet(e) {
  const VIDEO_STATUS = 3;
  const videoList = SpreadsheetApp.openById("1B7b9jEaWiqZI8Z8CzvFN1cBvLVYwjb5xzhWtrgs4anI").getSheetByName("SiIvaGunner");
  const filteredList = videoList.getDataRange().getValues().filter((video) => video[VIDEO_STATUS] == "Public");
  const randomVideo = filteredList[Math.floor(Math.random() * filteredList.length)];
  return ContentService.createTextOutput(`https://youtu.be/${randomVideo[0]}`);
}
Open remote post (opens in a new window)