Forked from erajanraja24/Scrape YouTube search Results
Created
April 9, 2020 03:11
-
-
Save saicharanreddyk/339670b2a285a578b9ac9f1fea11f201 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