Last active
December 9, 2020 10:51
-
-
Save iamtalhaasghar/45da0db61e2468c0d5bf98cae516a41e to your computer and use it in GitHub Desktop.
A simple javascript code snippet to scrap video list from a youtube playlist. Just open up the playlist in a new tab. Go to Console, paste the code and boom!!! ProTip: Copy the console log to clipboard and then paste the clipboard contents to a newly created .csv file. You will have your required data in a nice clean format.
This file contains 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
/* | |
I use this script to scrap video titles of a playlist of my competitor and | |
then I use those keywords in my playlist videos too. | |
Tested on Firefox 80.0.1 | |
Not sure about other browsers | |
*/ | |
// get div containing playlist items | |
playlist = document.getElementsByTagName('ytd-playlist-video-renderer') | |
videoNames = '' | |
for(i=0; i < playlist.length; i++){ | |
video = playlist[i].innerText.replace(',','').split('\n') // converts "videoname, title, views" => "videoname title views" | |
videoNames += video.toString() +"\n" | |
} | |
// Enjoy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment