Created
December 17, 2019 15:52
-
-
Save erajanraja24/d430a732a2bfb0d4e3448d39de1163d2 to your computer and use it in GitHub Desktop.
Scrape YouTube Search Results
This file contains hidden or 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 YouTubeScraper() { | |
var sh1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1"); | |
var keyword = sh1.getRange("B1").getValue(); | |
var results = YouTube.Search.list('id,snippet', {q:keyword, maxResults:50}); | |
//Video ID Published Date Channel ID "Video Title | |
//" Description Thumbnail URL Channel Title | |
var items = results.items.map(function(e){ | |
return [e.id.videoId, | |
e.snippet.publishedAt, | |
e.snippet.channelId, | |
e.snippet.title, | |
e.snippet.description, | |
e.snippet.thumbnails["default"].url, | |
e.snippet.channelTitle] | |
}) | |
sh1.getRange(4, 1, items.length, items[0].length).setValues(items) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where is the sheet to be found? It's not visible in your tutorial video, or here. Thank you.