Skip to content

Instantly share code, notes, and snippets.

@erajanraja24
Created December 17, 2019 15:52
Show Gist options
  • Save erajanraja24/d430a732a2bfb0d4e3448d39de1163d2 to your computer and use it in GitHub Desktop.
Save erajanraja24/d430a732a2bfb0d4e3448d39de1163d2 to your computer and use it in GitHub Desktop.
Scrape YouTube Search Results
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)
}
@singhujjwalkumar01
Copy link

i dont know coding but this code has solved my problem. how do i fetch no of subscriber

@MyEVerse
Copy link

Where is the sheet to be found? It's not visible in your tutorial video, or here. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment