Skip to content

Instantly share code, notes, and snippets.

@yazdipour
Created July 14, 2022 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yazdipour/237e580636861259704bab84df6023b9 to your computer and use it in GitHub Desktop.
Save yazdipour/237e580636861259704bab84df6023b9 to your computer and use it in GitHub Desktop.
Collected Youtube watchlater based on keyword
var urls = {};
$('ytd-playlist-video-renderer').each(function (index, value) {
var keywords = ["uwp", 'xaml', "xamarin", 'quantum', 'android', 'css', 'tax', 'unity', 'game', 'asp', 'linq', 'graphql', 'c#', 'python', 'canada', 'windows', 'dell'];
var hyperlink = $(value).find('a.ytd-playlist-video-renderer')[0];
var videoTitle = hyperlink.innerText.toLowerCase();
// for all keywords in the array
for (var i = 0; i < keywords.length; i++) {
// if the keyword is in the title
if (videoTitle.includes(keywords[i])) {
// urls.push(hyperlink.href);
urls[videoTitle] = hyperlink.href;
}
}
});
console.log(urls);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment