fetch all youtube links from any page

We made a list of great youtube videos on facebook comments and wanted to fetch these as a list, so I’ve been thinking how to achieve it. And there’s some javascript code you can paste into your console (javascript consone in a browser), it’ll fetch and display all the links for youtube. Easily change regexp to match url your want.

var seznam = ''; Array.prototype.slice.call(document.getElementsByTagName('a')).forEach(function(i){ if (i.href.match(/^http:\/\/www.youtube.com/) != null) {seznam+=i+"\n";}});document.getElementsByTagName('body')[0].innerHTML="<pre>"+seznam+"</pre>";

Leave a Reply

Your email address will not be published. Required fields are marked *

57 + = 59