Playlist.com | Get Mp3

By Ronald Troyer Last update Dec 14, 2010 — Installed 3,180 times.

Thought this might help

in
Subscribe to Thought this might help 6 posts, 3 voices



Liboicl Scriptwright

I have some code from the old playlist.com that would get the local links. I've been looking over it, thinking about trying to remake it to work with the new search, but I figured since you've already started there was no sense in repeating the such. So, here it is:
// ==UserScript==
// @name Projectplaylist
// @namespace sizzlemctwizzle
// @description Download Songs off of Projectplaylist. Works on all songs.
// @include *search.playlist.com*
// ==/UserScript==

function hexToChars (hex) {
var a = new Array();
var b = (hex.substr(0, 2) == '0x') ? 2 : 0;
while (b < hex.length) {
a.push(parseInt(hex.substr(b, 2), 16));
b += 2;
}
return a;
}

function charsToStr (chars) {
var a = '';
var b = 0;
while (b < chars.length) {
a += String.fromCharCode(chars[b]);
++b;
}
return a;
}

function strToChars (str) {
var a = new Array();
var b = 0;
while (b < str.length) {
a.push(str.charCodeAt(b));
++b;
}
return a;
}

function initialize (pwd) {
var a = 0;
var b;
var c = pwd.length;
var d = 0;
while (d <= 255) {
mykey[d] = pwd[d % c];
sbox[d] = d;
++d;
}
d = 0;
while (d <= 255) {
a = (a + sbox[d] + mykey[d]) % 256;
b = sbox[d];
sbox[d] = sbox[a];
sbox[a] = b;
++d;
}
}

function calculate (plaintxt, psw) {
initialize(psw);
var a = 0;
var b = 0;
var c = new Array();
var d;
var e;
var f;
var g = 0;
while (g < plaintxt.length) {
a = (a + 1) % 256;
b = (b + sbox[a]) % 256;
e = sbox[a];
sbox[a] = this.sbox[b];
sbox[b] = e;
var h = (sbox[a] + sbox[b]) % 256;
d = sbox[h];
f = plaintxt[g] ^ d;
c.push(f);
++g;
}
return c;
}

function decrypt (src, key) {
var plaintxt = hexToChars(src);
var psw = strToChars(key);
var chars = calculate(plaintxt, psw);
return charsToStr(chars);
}

function getSongs() {
var dev = document.evaluate(
'//a[contains(@id,"playimg")]',
document,
null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);

for (var i = 0; i < dev.snapshotLength; i ++) {
item = dev.snapshotItem(i);
id = item.getAttribute('id').split('playimg')[1];
src = unsafeWindow.trackdata[id - 1].song_url;
if (src.substring(0, 4) != 'http') {
var key = 'sdf883jsdf22';
sbox = new Array(255);
mykey = new Array(255);
src = decrypt(src, key);
}
link = document.createElement('a');
link.href = src;
txt = document.createTextNode("Download");
link.appendChild(txt);
link.setAttribute('style', 'font-size:11px;');
item.parentNode.parentNode.appendChild(link);
}
}

GM_addStyle('.marklink { display:none; } ');
getSongs();

 
Ronald Troyer Script's Author

Thanks. I hope they haven't changed their salt.

//--Edit--//
OMG. Thank you. The salt is still correct. Now I just need to find the temporary location, when not in a playlist. But thank you. I will have to thank sizzlemctwizzle too.

 
sizzlemctwizzle Scriptwright
FirefoxMacintosh

Lol glad to see somebody still had a copy of that script, although it is a really old version. This is one of my three controversial scripts (the other two are AmazonMp3/Playlist.com Mashup and Download Facebook Audio) that I deleted from userscripts.org for fear of legal ramifications. That decryption code is proprietary actionscript code that I took from a flash mp3 player ;)

Somebody posted the latest version(2.2.1) I released on this site. The up-to-date version(2.2.2): http://pastebin.com/f208b6f0d

And yes it does get the download links of an entire playlist.

If you like you can just post my script.

 
Ronald Troyer Script's Author
FirefoxWindows

Sounds good to me. I was considering writing in that functionality, just had been too busy to do so.

 
sizzlemctwizzle Scriptwright
FirefoxMacintosh

Here's an update of the script for the change in the site:

// ==UserScript==
// @name           Download Songs from Project Playlist
// @namespace      sizzlemctwizzle
// @description    This script allows you to download ALL SONGS on playlist.com and has been updated to work with the latest update of the site.
// @version        2.2.2
// @include        http://*.playlist.com/search*/tracks*
// ==/UserScript==

function getSongs() {
  forEach($x('//li[starts-with(@id, "tracklink-") and not(@decrypted)]', $('results')), function(li, i) {
    sbox = new Array(255);
    mykey = new Array(255);
    li.appendChild(create(' | '));
    li.appendChild(create('a', { href: decrypt(unsafeWindow.trackdata[i].song_url, 'sdf883jsdf22'), innerHTML: "Download song" }));
    li.setAttribute('decrypted', 'true');
  });
}

function $(element) { return document.getElementById(element); }
function create(A, B, C) {
	if (!B) 
		A = document.createTextNode(A);
	else {
		A = document.createElement(A);
		for (var b in B) {
			if (b.indexOf("on") == 0)
				A.addEventListener(b.substring(2), B[b], false);
			else if (b == "style")
				A.setAttribute(b, B[b]);
			else
				A[b] = B[b];
		}
		if (C) 
			for(var i = 0, len = C.length; i<len; i++)
				A.appendChild(C[i]);
	}
	return A;
}
function forEach(lst, cb) {
    if (lst.snapshotItem) {
        var i = 0, len = lst.snapshotLength;
        while (i < len) 
            cb(lst.snapshotItem(i), i++, lst);
    }
    else if (lst.iterateNext) {
        var item;
        while (item = lst.iterateNext()) 
            cb(item, lst);
    }
    else if (lst.forEach) 
        lst.forEach(cb);
    else if (lst.length && typeof lst === 'object') 
        Array.forEach(lst, cb);
    else if (typeof lst === 'object')
        for (var i in lst) cb(lst[i], i, lst);
    else 
        return false;
}
function $x(x, t, r) {
    if (t && t.nodeType) 
        var h = r, r = t, t = h;    
    var d = r ? r.ownerDocument || r : r = document, p;
    switch (t) {
    case 1:
        p = 'numberValue';
        break;
    case 2:
        p = 'stringValue';
        break;
    case 3:
        p = 'booleanValue';
        break;
    case 8: case 9:
        p = 'singleNodeValue';
        break;
    default:
        return d.evaluate(x, r, null, t || 6, null);
    }
    return d.evaluate(x, r, null, t, null)[p];
}

function hexToChars (hex) {
          var a = new Array();
          var b = (hex.substr(0, 2) == '0x') ? 2 : 0;
          while (b < hex.length) {
            a.push(parseInt(hex.substr(b, 2), 16));
            b += 2;
          }
          return a;
}

function charsToStr (chars) {
          var a = '';
          var b = 0;
          while (b < chars.length) {
            a += String.fromCharCode(chars[b]);
            ++b;
          }
          return a;
}

function strToChars (str) {
          var a = new Array();
          var b = 0;
          while (b < str.length) {
            a.push(str.charCodeAt(b));
            ++b;
          }
          return a;
}

function initialize (pwd) {
          var a = 0;
          var b;
          var c = pwd.length;
          var d = 0;
          while (d <= 255) {
            mykey[d] = pwd[d % c];
            sbox[d] = d;
            ++d;
          }
          d = 0;
          while (d <= 255) {
            a = (a + sbox[d] + mykey[d]) % 256;
            b = sbox[d];
            sbox[d] = sbox[a];
            sbox[a] = b;
            ++d;
          }
}

function calculate (plaintxt, psw) {
          initialize(psw);
          var a = 0;
          var b = 0;
          var c = new Array();
          var d;
          var e;
          var f;
          var g = 0;
          while (g < plaintxt.length) {
            a = (a + 1) % 256;
            b = (b + sbox[a]) % 256;
            e = sbox[a];
            sbox[a] = this.sbox[b];
            sbox[b] = e;
            var h = (sbox[a] + sbox[b]) % 256;
            d = sbox[h];
            f = plaintxt[g] ^ d;
            c.push(f);
            ++g;
          }
          return c;
}

function decrypt(src, key) {
          var plaintxt = hexToChars(src);
          var psw = strToChars(key);
          var chars = calculate(plaintxt, psw);
          return charsToStr(chars);
}

function process() {
   $('searchResultsColumn').removeEventListener('DOMNodeInserted', process, false);
  var checker=setInterval(function(){
      if(unsafeWindow.trackdata.length && $('loadingModal').getAttribute('style').match(/display: none;/)) {
        clearInterval(checker);
        getSongs();
        $('searchResultsColumn').addEventListener("DOMNodeInserted", process, false);
      }
    },200);
}

if(typeof unsafeWindow==='undefined') unsafeWindow = window;
var checker=setInterval(function(){
        if(unsafeWindow.trackdata) {
            clearInterval(checker);
            process();
        }
},200);

 
Ronald Troyer Script's Author
FirefoxWindows

Thanks. I just noticed the change tonight. I like the new color scheme.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel