python3, 解析迅雷地址为原地址

解析迅雷地址为原地址,
gist地址: https://gist.github.com/leo493852107/b51b8f8cd3af4594a716920f3648d58b
#!/usr/bin/env python
# -*- coding: utf-8 -*-

__author__ = "leo"
__time__ = "2018-01-12"


'''
解析迅雷地址为原地址

thunder://QUFodHRwJTNBJTJGJTJGenVpZGF6eS54dW5sZWl6aXl1YW4ubmV0JTJGMTgwMSUyRiVFOCU5OSU4RSVFNSU5NSVCOCVFOSVCRSU5OSVFNSU5MCU5Ri00MC5tcDRaWg==

参考:
http://www.iplaypy.com/code/security/se2360.html
'''

import base64

import re
from urllib.parse import unquote
import urllib3

import requests


def convert_thunder_url(thunder_url):
    request_url = "https://tool.lu/urlconvert/ajax.html"

    params = {
        "link": thunder_url
    }

    res = requests.post(request_url, params=params).json()
    http_str = res['text']['http']
    return http_str


def jie_ma(http_str):
    print(unquote(http_str))


def convert_2(thunder_url):
    tmp = thunder_url.replace('thunder://', '')
    http_str = base64.b64decode(tmp.encode()).decode('gbk')[2:-2]
    return http_str


if __name__ == '__main__':
    print("将迅雷链接转换为真实地址:")

    while True:
        thunder_url = input("请输入迅雷链接:")
        http_str = convert_2(thunder_url)
        jie_ma(http_str)

    # while True:
    #     thunder_url = input("请输入迅雷链接:")
    #     http_str = convert_thunder_url(thunder_url)
    #     jie_ma(http_str)

 

转载于:https://www.cnblogs.com/leo23/p/8279915.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值