美文网首页
迅雷链接的编码与解码

迅雷链接的编码与解码

作者: 52_St | 来源:发表于2018-03-08 00:15 被阅读18次
# 编码(JS)
function ThunderEncode(t_url) {

    var thunderPrefix = "AA";

    var thunderPosix = "ZZ";

    var thunderTitle = "thunder://";

    var thunderUrl = thunderTitle + base64encode(utf16to8(thunderPrefix + t_url + thunderPosix));

    return thunderUrl;
}

# 翻译成(Python)
import base64

def ThunderEncode(t_url):

    thunderPrefix = 'AA'
    
    thunderPosix = 'ZZ'
    
    thunderTitle = 'thunder://'

    thunderUrl = thunderTitle + base64.b64decode((thunderPrefix + t_url + thunderPosix).encode('utf-8'))
    
    return thunderUrl
# 解码
import base64
from urllib.parse import unquote


def ThunderDecode(thunderUrl):

    t_url = unquote(base64.b64decode(thunderUrl[10:]).decode('utf-8')[2:-2])

    return t_url

相关文章

网友评论

      本文标题:迅雷链接的编码与解码

      本文链接:https://www.haomeiwen.com/subject/extefftx.html