Muxtaster

By Bjorn Stromberg Last update Jan 28, 2009 — Installed 6,099 times.

Archived Comments (locked)

in
Subscribe to Archived Comments 49 posts, 17 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
jstn User

script stopped working

 
MartinJo User

@Casanova: Excellent scripts. They work great.

Though, for security reasons I would advise to hardcode the download directory in the AppleScript and strip "../" from the filename. Otherwise every rogue website would be able to replace arbitrary files on your hard disc with content of their choosing, e.g., by loading the URL

muxtapedownloader://com.apple.AppleScript.muxtapedownloader?SOMEURL@/etc/passwd

in a hidden iframe (this probably would not work due to file permissions, but you get the picture).

 
Bjorn Stromberg Script's Author

Sorry about that, it should be fixed now.

 
rolands User

Links to download dont seem to show up and i dont get a alert saying muxtaster is loaded in the newest version...

 
Bjorn Stromberg Script's Author

Some great additions to this script, I'm so happy to see everyone working together to build great things off of Muxtape. I added the changes Rezo suggested, but I can't test them as I don't have a mac. I'd really appreciate it if someone could try out the new script and let me know if it works.

Thanks :)

 
Casanova User

In order to fix the downloading to automatically have the right name and automatically start as soon as you click, I made an AppleScript app that registers its own protocol (which we use to communicate through from our SSB) and wgets the file in the way we want. I thought others might be interested. To do this, open Script Editor and make a new script as follows:

on open location this_URL
	set x to the offset of "?" in this_URL
	set y to the offset of "@" in this_URL
	set mp3URL to text (x + 1) thru (y - 1) of this_URL
	set filename to (do shell script ("echo \"" & (text from (y + 1) to -1 of this_URL) & "\" | sed 's/%20/\\\\ /g'"))
	tell application "Terminal" to do script ("wget -O " & filename & " \"" & mp3URL & "\" && exit")
end open location

on run_scriptfile(this_scriptfile)
	try
		set the script_file to path to resource this_scriptfile
		return (run script script_file)
	on error
		return false
	end try
end run_scriptfile

on load_run(this_scriptfile, this_property_value)
	try
		set the script_file to path to resource this_scriptfile
		set this_script to load script script_file
		tell script this_script
			set some_script_property to this_property_value
		end tell
		return (run script this_script)
	on error
		return false
	end try
end load_run

Then save as an "Application Bundle" (in File Format; all options unchecked) called muxtapedownloader.app. You'll need wget; it doesn't come with Leopard so get it with macports. Here, I use tell application "Terminal" to do script instead of do shell script because I want to see the wget progress. Because we &&exit the terminal window will close as long as wget completed successfully. Now, show the contents of the new .app and open Info.plist. Overwrite it with the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleAllowMixedLocalizations</key>
	<true/>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleExecutable</key>
	<string>applet</string>
	<key>CFBundleIconFile</key>
	<string>applet</string>
	<key>CFBundleIdentifier</key>
	<string>com.apple.AppleScript.muxtapedownloader</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>muxtapedownloader</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleSignature</key>
	<string>aplt</string>
	<key>CFBundleURLTypes</key>
	<array>
		<dict>
			<key>CFBundleURLName</key>
			<string>muxtape Downloader</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>muxtapedownloader</string>
			</array>
		</dict>
	</array>
	<key>LSRequiresCarbon</key>
	<true/>
	<key>WindowState</key>
	<dict>
		<key>name</key>
		<string>ScriptWindowState</string>
		<key>positionOfDivider</key>
		<real>294</real>
		<key>savedFrame</key>
		<string>94 356 696 496 0 0 1440 878 </string>
		<key>selectedTabView</key>
		<string>result</string>
	</dict>
</dict>
</plist>

Now, run the .app and it will register our protocol. Now we need to modify the muxtaster script. Change the downloadMP3 function signature to function (song_key, name, tdelay). Change the true clause of the if in the onload handler to set the location so: window.location.href = "muxtapedownloader://com.apple.AppleScript.muxtapedownloader?"+responseDetails.responseText+"@~/Downloads/muxtape/"+name+".mp3";. Here is where you would select where you want to save muxtape mp3s to. I have them download to ~/Downloads/muxtape. You can change it. Make sure to create the directory. Now change setAttribute('href', "javascript:downloadMP3('"+song_key+"');"); to setAttribute('href', "javascript:downloadMP3('"+song_key+"','"+trackname+"');");. You're done.

I also changed the script so that instead of adding that annoying large li after each track, it changes the buy link to be the download link and relabels it so. To do this, I replace everything starting with var header_color = '#333333'; to the end of the script with simply

var stripes = document.getElementsByTagName('li');

window.setTimeout(function() {
	for(var i=0; i<stripes>= 0) {
			var song_key = stripes[i].id.replace('stripe','');		

			var stripe = stripes[i];
			var tname = stripe.getElementsByTagName('div');
			var trackname = tname[0].innerHTML;

			trackname = trackname.replace(/^\s+|\s+$/g, '');
			trackname = trackname.replace(/(<([^>]+)>)/ig, '');

			var buylink = ((tname[1].getElementsByTagName('span'))[1].getElementsByTagName('a'))[0];
			buylink.innerHTML="Download";
			buylink.setAttribute('href', "javascript:downloadMP3('"+song_key+"','"+trackname+"');");
		}
	}
}, 0);

Hope this helps someone.

 
rezo User

actually yes,

the following 2 things are needed in the source in order to make it

1. use window instead of unsafewindow in fluid:

var win = typeof unsafeWindow != "undefined" ? unsafeWindow : window;
win.downloadMP3 = function (song_key, tdelay) {

2. greasekit lacks the GM_xmlhttprequest:


if(typeof GM_xmlhttpRequest === "undefined") {
GM_xmlhttpRequest = function(/* object */ details) {
details.method = details.method.toUpperCase() || "GET";

if(!details.url) {
throw("GM_xmlhttpRequest requires an URL.");
return;
}

// build XMLHttpRequest object
var oXhr, aAjaxes = [];
if(typeof ActiveXObject !== "undefined") {
var oCls = ActiveXObject;
aAjaxes[aAjaxes.length] = {cls:oCls, arg:"Microsoft.XMLHTTP"};
aAjaxes[aAjaxes.length] = {cls:oCls, arg:"Msxml2.XMLHTTP"};
aAjaxes[aAjaxes.length] = {cls:oCls, arg:"Msxml2.XMLHTTP.3.0"};
}
if(typeof XMLHttpRequest !== "undefined")
aAjaxes[aAjaxes.length] = {cls:XMLHttpRequest, arg:undefined};

for(var i=aAjaxes.length; i--; )
try{
oXhr = new aAjaxes[i].cls(aAjaxes[i].arg);
if(oXhr) break;
} catch(e) {}

// run it
if(oXhr) {
if("onreadystatechange" in details)
oXhr.onreadystatechange = function() { details.onreadystatechange(oXhr) };
if("onload" in details)
oXhr.onload = function() { details.onload(oXhr) };
if("onerror" in details)
oXhr.onerror = function() { details.onerror(oXhr) };

oXhr.open(details.method, details.url, true);

if("headers" in details)
for(var header in details.headers)
oXhr.setRequestHeader(header, details.headers[header]);

if("data" in details)
oXhr.send(details.data);
else
oXhr.send();
} else
throw ("This Browser is not supported, please upgrade.")
}
}

enjoy,

reza

 
Marcel T User

Anyone got any pointers on getting this going in Fluid (www.fluidapp.com)?

 
gingerbeardman Scriptwright

I understand that. I was wondering if it was possible to push the file download through an external script that could force the file to be downloaded?

Meanwhile, I am using this at line 280: window.open(responseDetails.responseText, song_key); which opens each mp3 in it's own window.

 
Bjorn Stromberg Script's Author

Your browser decides what it does with mp3 files, not this script.

 
gingerbeardman Scriptwright

Any chance you can force the mp3 to download rather than opening in a browser window? Can you send a different mime type for it? Thanks!

 
no0n Scriptwright

I prefer it not interrupting my songplay and replaced line 280 with window.open(responseDetails.responseText, "muxdownload");

Of course you'd have to allow popups from muxtape.com which might be annoying for 5seconds until you open your popup settings. Just a thought

 
Bjorn Stromberg Script's Author

If you turn them into FLV's it will just make it easier to download them with proper song titles and extensions, you'd be doing us all a favor. Except of course that it will take time to process the files before they're available.

 
jstn User

MP3s will always go in. What comes out?

 
greedy_genius User

Umm, just use the FF ext. downloadhelper. it works perfect every time. these muxtape scripts always give me problems.

 
mika22 User

You're disallowing mp3s at all now? ROFL. Why don't you just close the site permanently while you're at it.

Good while it lasted I suppose.

 
jstn User

The point of Muxtape is putting things in S3? Think bigger, guys!

 
nathaniel_hi... Scriptwright

stop using muxtape?
i'm confused...isn't that the whole point of muxtape? let users submit mp3s which are then hosted by you on S3 (with the option of buying said song)

if you go the imeem route, you can still grab the music..it's not any more secure than anything else. it seems like you'd cut off your nose to spite the rest of your face.

but uh, cool? i guess now we'll just see what you mean soon right?

and i'm sure you realize, but at the most basic if it came down to it, there's ways to save audio outside of directly grabbing the file. if someone really wants it, they'll grab it. valiant efforts and all...shrug...

 
jstn User

What are you guys going to do when the site stops using mp3s?

 
nathaniel_hi... Scriptwright

i guess this is like the coders version of a mexican standoff

he takes the site down, updates the salt in various wacky ways

this breaks your script

you update your script to the new salt

wash, rinse, repeat.

i'd say eventually he'd get tired of this, but it's probably the back end dude he hired doing it, so you know, back and forth we go.

you should just put up how you decompile the cutter so it's more then just you updating this thing...just a suggestion

 
Bjorn Stromberg Script's Author

This time the salt was hexcode, I guess Justin thought it would blend in?

 
Nemanja Stef... Scriptwright

It's his site, Mika. He can do whatever he wants with it to try to stop things he doesn't like. Everyone knows his entire concept is on shaky legal grounds. Even if little scripts like this that make direct links are gone, it's only slightly more effort to download with things like Firebug. Not too big of a deal I think.

As for muxtape search engines, http://muxtapestumbler.com/ has been around for a while and doesn't seem like it's going to stop, good site.

 
mika22 User

I just dont understand why the guy is so interested on continously blocking the script when streaming is not precisely legal. What does he care what a few of us want to do with it. I understand why would he be paranoid regarding the mp3s but he never provided any download links in the first place, he has no responsability on this at all. Must have way too much free time. If he's really that paranoid he should be saving his money and time on looking for good lawyers or buying a ticket to Norway.

He even took down mux search engines as if that would make any fucking difference. It really pisses me off, I see the trouble with mp3s but even following his only seeing not touching rules if I want to go back to a forgotten muxtape I liked and that I only remember by an artist's song I can't.

Anyways. I'm sure both of you can outsmart them, you've done beautifully so far. Thank you.

 
Nemanja Stef... Scriptwright

haha. oh man. any ideas on this one Bjorn?