喜马拉雅算法解析 (两种算法)

第二种算法pc接口算法直接通过url地址解析

先说第一种算法 

打开限免的小说 经过分析找到此包 红箭头下面是音频地址(https://audiopay.cos.tx.xmcdn.com/download/1.0.0/storages/732b-audiopay/06/2F/GKwRIaIFZ5gsACBfRQD3YvQj.m4a?sign=8b56df4f2b1efaa1e6b5c444f77c157a&buy_key=FM&token=2002&timestamp=1638853302&duration=685

 跟进js

 1.m4a的路径js算法

function i(t) {
    this._randomSeed = t,
        cg_hun()
}
function cg_hun() {
    this._cgStr = "";
    var t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890"
        , e = t.length
        , r = 0;
    for (r = 0; r < e; r++) {
        var n = ran() * t.length
            , o = parseInt(n);
        this._cgStr += t.charAt(o),
            t = t.split(t.charAt(o)).join("")
    }
}
 function ran() {
    return this._randomSeed = (211 * this._randomSeed + 30031) % 65536,
    this._randomSeed / 65536
}

function cg_fun(t) {
    t = t.split("*");
    var e = ""
        , r = 0;
    for (r = 0; r < t.length - 1; r++)
        e += this._cgStr.charAt(t[r]);
    return e
}
var seed=5765
var fileId="27*45*19*64*47*52*28*27*26*67*63*5*0*10*47*13*37*58*19*15*47*40*26*41*30*26*5*2*26*42*59*8*14*36*47*36*2*57*43*52*27*3*32*39*35*14*53*22*63*18*48*53*12*24*54*31*47*"
i(seed)
m4a=cg_fun(fileId)
console.log(m4a)

直接运行得到

下面是python代码:

class m4a():
    def __init__(self,t):
        self._randomSeed = t
        self.cg_hun()
    def cg_hun(self):
        self._cgStr = ""
        t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890"
        e = len(t)
        r=0
        for r in range(e):
            n=self.ran()*len(t)
            o=int(n)
            self ._cgStr +=t[o]
            t = "".join(t.split(t[o]))
    def ran(self):
        self._randomSeed = (211 * self._randomSeed + 30031) % 65536
        return self._randomSeed / 65536

    def cg_fun(self,t):
        t = t.split('*')

        e = ""
        r = 0
        for r in range(len(t) - 1):
            e += self._cgStr[int(t[r])]
        return e
if __name__ == '__main__':
    seed = 5765
    fileId = "27*45*19*64*47*52*28*27*26*67*63*5*0*10*47*13*37*58*19*15*47*40*26*41*30*26*5*2*26*42*59*8*14*36*47*36*2*57*43*52*27*3*32*39*35*14*53*22*63*18*48*53*12*24*54*31*47*"
    s=m4a(seed)
    m4a_url=s.cg_fun(fileId)
    print(m4a_url)

 2.通过ep来计算url参数的js算法

function o(t, e) {
    var r = 0
        , n = 0
        , o = []
        , i = 0;
    for (o = [],
             i = 0; i < t.length; i++) {

        for (r = 0,
                 r = t[i] >= "a" && t[i] <= "z" ? t[i].charCodeAt(0) - 97 : t[i] - 0 + 26,
                 n = 0; n < 36; n++)
            if (e[n] == r) {
                r = n;
                break
            }
        o[i] = r > 25 ? r - 26 : String.fromCharCode(r + 97)
    }


    return o.join("")
}
function i (t) {
    if (!t)
        return "";
    var e, r, n, o, i, a = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1];

    for (o = (t = t.toString()).length,
             n = 0,
             i = ""; n < o; ) {
        do {

            e = a[255 & t.charCodeAt(n++)]

        } while (n < o && -1 == e);
        if (-1 == e)
            break;
        do {

            r = a[255 & t.charCodeAt(n++)]
        } while (n < o && -1 == r);
        if (-1 == r)
            break;
        i += String.fromCharCode(e << 2 | (48 & r) >> 4);
        do {

            if (61 == (e = 255 & t.charCodeAt(n++)))
                return i;
            e = a[e]
        } while (n < o && -1 == e);
        if (-1 =&#
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值