User Tools

Site Tools


Firefox media extraction with NoScript (& JS hell)

Consider default Firefox with NoScript. If you load for example some random page on SoundCloud and allow JavaScript, you will see the <audio> element incl. URL in “Blocked objects”. However no matter how you click it is impossible to extract the URL by other ways than typing it by hand. The <audio> element does not even show in Page info nor in Generated source - there is some black JavaScript magic used that confuses Firefox to not show the generated HTML5 element it is currently using. SoundCloud is not the only page that has this problem.

With the following patch NoScript logs blocked plugins into browser console (Ctrl+Shift+J, maybe Firebug must be installed first). You can conveniently copy them from there.

--- noscript/content/noscript/noscriptOverlay.js	2014-10-24 00:11:26.000000000 +0200
+++ /tmp/noscriptOverlay.js	2015-01-15 19:32:10.911632009 +0100
@@ -1146,7 +1146,11 @@
         e.title = e.title || e.label.split("@")[0] + "@" + e.url + "\n(" + e.originSite + ")";
         node.setAttribute("label", this.getString("allowTemp", [e.label]));
+	var aConsoleService = Cc[";1"].getService(Ci.nsIConsoleService);
+	var console = {log:function(str){aConsoleService.logStringMessage("NoScript Plugin Populate2 "+e.title);}}
         node.setAttribute("tooltiptext", e.title);
+	console.error("NoScript Plugin Populate1 "+e.title);
+	console.log("NoScript Plugin Populate3 "+e.title);
         node.setAttribute("oncommand", "noscriptOverlay.allowObject(" + i + ")");
         node.setAttribute("class", "menuitem-iconic noscript-cmd noscript-temp noscript-allow"); = ns.cssMimeIcon(e.mime, 16);
@@ -1193,6 +1197,8 @@
             let node = document.createElement("menuitem");
             node.setAttribute("label", this.getString("allowTemp", [ns.mimeEssentials(mime) + "@" + where]));
             node.setAttribute("tooltiptext", mime + "@" + where);
+            console.log("NoScript Plugin Populate4 "+where);
+            console.error("NoScript Plugin Populate6 "+where);
             node.setAttribute("oncommand", "noscriptOverlay.allowObjectSite(" + i + ")");
             node.setAttribute("class", "menuitem-iconic noscript-temp noscript-cmd noscript-allow");
             if(mime != "*")

I hoped that with the advent of HTML5, media distribution would be again simple and it would be possible to simply extract the URL for playing in your own player. Unfortunately this does not seem to be true.

firefox-media.txt · Last modified: 2015-04-09 23:34:27 (external edit)