纯属无聊,本来只是想写个豆瓣的插件,看到歌曲列表以后就可以在线试听或者下载,不过不能直接从搜索结果列表拿到mp3或者wma的真实地址,只能进去下载页面分析。

不过下载页面的地址的加密倒是简单,很容易就发现了URL密文和明文的对应关系,再稍微看一下JavaScript,就知道怎么还原了。还原方法如下(还是JavaScript版本的):

//48-0, 65-A, 97-a
var CHARACTERS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

function decode(url, offset) {
    var l = url.length;
    var s = '', idx, ch;
    for (var i = 0; i < l; i++) {
        ch = url.charAt(i);
        if (/[A-Za-z0-9]/.test(ch)) {
            idx = CHARACTERS.indexOf(ch) - offset;
            if (idx < 0) {
                idx += 62
            }
            ch = CHARACTERS.charAt(idx);
        }
        s += ch;
    }
    return s;
}

var u = 'jvvr://yyy.mcmctkpi.eqo/wrnqcf/422A.34.39_32.33.59_5B79.or5';
//var u = 's440://E0xyn.nyx53tnn.nzx.ny/C/JJH.x0E';

var hp = 43 // s.indexOf('h');
if(u.indexOf(':') == 3){
    hp = 41; //s.indexOf('f');
}
var o = CHARACTERS.indexOf(u.charAt(0)) - hp;

alert(decode(u, o));

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.