Created
February 14, 2015 15:59
-
-
Save Tomfox91/3cad3be2e6790a7c8712 to your computer and use it in GitHub Desktop.
Bookmarklet to extract media URLs from webpages. http://gh.t-f.pw/mediaExtractor/ (jQuery insertion code from http://benalman.com/projects/run-jquery-code-bookmarklet/)
This file contains hidden or 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
(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="https://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){ | |
var ul = $('<ul></ul>'); | |
var urls = $('video,audio') | |
.map(function() { | |
return $(this).attr('src');}); | |
if (urls.length) { | |
urls.each(function() { | |
var li = $('<li style="' + | |
"list-style: disc outside none !important; " + | |
"word-break: break-all !important; " + | |
'"></li>'); | |
li.append('<a href="' + this + '">' + this + '</a>'); | |
ul.append(li);}) | |
} else { | |
ul = $('<strong>No media found</strong>'); | |
} | |
var d = $('<div id="mediaExtractor" style="' + | |
"background: rgba(255,255,200,0.9) !important; " + | |
"color: black !important; " + | |
"font-family: Helvetica,Arial,sans-serif !important; " + | |
"font-size: 13px !important; " + | |
"position: fixed !important; " + | |
"top: 0 !important; " + | |
"left: 0 !important; " + | |
"margin: 1% !important; " + | |
"padding: 1.5em !important; " + | |
"border-radius: 6px !important; " + | |
"z-index: 2147483647 !important; " + | |
"max-width: 98% !important; " + | |
'"></div>'); | |
var c = $('<div style="' + | |
"position: fixed !important; " + | |
"margin: 1% !important; " + | |
"top: 0 !important; " + | |
"left: .2em !important; " + | |
"font-size: 18px !important; " + | |
'"></div>'); | |
c.append($('<a href="#" style="' + | |
'">×</a>') | |
.click(function(){d.remove();})); | |
d.append(c); | |
d.append(ul); | |
$('body').append(d); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment