Instantly share code, notes, and snippets.

Embed
What would you like to do?
descargar serp youtube csv
javascript: var j=0; var output = 'Position;Type;URL;Title'; if(window['ytInitialData'].contents.twoColumnBrowseResultsRenderer){var divClasses = window['ytInitialData'].contents.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents;}else{var divClasses = window['ytInitialData'].contents.twoColumnSearchResultsRenderer.primaryContents.sectionListRenderer.contents[0].itemSectionRenderer.contents;}for(var i=0;i<divClasses.length;i++){var type = false; if( divClasses[i].videoRenderer ){var type = 'VIDEO';var link = divClasses[i].videoRenderer;var anchorText = link.title.simpleText; var anchorLink = 'https://www.youtube.com/watch?v=' + link.videoId; }else if( divClasses[i].channelRenderer ){var type = 'CHANNEL';var link = divClasses[i].channelRenderer;var anchorText = link.title.simpleText; var anchorLink = 'https://www.youtube.com/channel/' + link.channelId; }else if( divClasses[i].radioRenderer ){var type = 'RADIO';var link = divClasses[i].radioRenderer;var anchorText = link.title.simpleText; var anchorLink = 'https://www.youtube.com/watch?v=' + link.navigationEndpoint.watchEndpoint.videoId + '&list=' + link.navigationEndpoint.watchEndpoint.playlistId + '&start_radio=1'; }else if( divClasses[i].playlistRenderer ){ var type = 'PLAYLIST'; var link = divClasses[i].playlistRenderer; var anchorText = link.title.simpleText; var anchorLink = 'https://www.youtube.com/playlist?list=' + link.playlistId; } if( type ){j++; output += '\n' + j + ';' + type + ';' + anchorLink + ';' + anchorText; }} var hiddenElement = document.createElement('a'); hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(output); hiddenElement.download = document.title + '.csv'; hiddenElement.click();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment