Forked from erajanraja24/Scrape YouTube search Results
Created
January 7, 2020 00:12
-
-
Save dnalob/80482dd16fce22d0ee6138aa158ef12f 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