关于base64编码的知识请谷歌。
以下都假设普通地址为:http://lovedboy.tk/lovedboy.txt
1 ,普通地址转换为迅雷下载地址:
在原地址前面加"AA",后面加"ZZ"(注:不包括引号),地址变为
AAhttp://lovedboy.tk/lovedboy.txtZZ
编码后变成:
QUFodHRwOi8vbG92ZWRib3kudGsvbG92ZWRib3kudHh0Wlo=
再加上迅雷专链变为:
thunder://QUFodHRwOi8vbG92ZWRib3kudGsvbG92ZWRib3kudHh0Wlo=
2,普通地址转换为快车下载地址:
在原地址前后都加上"[FLASHGET]"(注:不包括引号),地址变为
[FLASHGET]http://lovedboy.tk/lovedboy.txt[FLASHGET]
此地址编码为:
W0ZMQVNIR0VUXWh0dHA6Ly9sb3ZlZGJveS50ay9sb3ZlZGJveS50eHRbRkxBU0hHRVRd
快车专链即在上地址前加flashget://,注意后面还要加上"&符号",
flashget://W0ZMQVNIR0VUXWh0dHA6Ly9sb3ZlZGJveS50ay9sb3ZlZGJveS50eHRbRkxBU0hHRVRd&
3、普通地址转换为旋风地址
旋风相对就简单多了,将原地址直接base64编码为
aHR0cDovL2xvdmVkYm95LnRrL2xvdmVkYm95LnR4dA==
旋风专链即在上地址前加qqdl://,即
qqdl://aHR0cDovL2xvdmVkYm95LnRrL2xvdmVkYm95LnR4dA==
转换原理基本就这样。
好吧。下面我用python实现一个转换工具。python有一个base64模块专用于base46加解密。
直接上源码吧。
#coding:utf-8 ''' 当要转换快车地址时,参数必须用分号引起来,不然会有一个bug,因为符号'&'的关系 ''' import base64 import sys def http_thunder(url): ''' http to thunder''' data = 'AA' + url + 'ZZ' return 'thunder://'+ base64.b64encode(data) def http_flashget(url): '''http to flashget ''' data = '[FLASHGET]' + url + '[FLASHGET]' return 'flashget://' + base64.b64encode(data) + '&' def http_qqdl(url): '''http to qqdl''' return 'qqdl://' + base64.b64encode(url) def thunder_http(thunder): '''thunder to http''' if not thunder.startswith('thunder://'): print '不合法的迅雷下载地址' exit(1) data = thunder[10:] #print data decode_data = base64.b64decode(data) url = decode_data[2:-2] return url def flashget_http(flashget): '''flashget to http''' if not flashget.startswith('flashget://'): print '不合法的快车地址' exit(1) flashget=flashget.split('&') data = flashget[0][11:] decode_data = base64.b64decode(data) url = decode_data[10:-10] return url def qqdl_http(qqdl): '''qqdl to http''' if not qqdl.startswith('qqdl://'): print '不合法的qq旋风地址' exit(1) data = qqdl[7:] decode_data = base64.b64decode(data) return decode_data ''' print http_thunder(sys.argv[1]) print http_flashget(sys.argv[1]) print http_qqdl(sys.argv[1]) ''' #print thunder_http(sys.argv[1]) #print flashget_http(sys.argv[1]) #print qqdl_http(sys.argv[1]) def main(): if len(sys.argv) == 1 or sys.argv[1] in ('-h', '--help' ) : print ''' python tran.py http://******** python tran.py thunder://********** python tran.py flashget://********** python tran.py qqdl://********** ''' exit(0) if sys.argv[1].startswith('http://'): print http_thunder(sys.argv[1]) print http_flashget(sys.argv[1]) print http_qqdl(sys.argv[1]) elif sys.argv[1].startswith('thunder://'): print thunder_http(sys.argv[1]) elif sys.argv[1].startswith('flashget://'): print flashget_http(sys.argv[1]) elif sys.argv[1].startswith('qqdl://'): print qqdl_http(sys.argv[1]) if __name__ == '__main__' : main()
测试下:
普通地址转换为其他专用地址:
lovedboy@ubuntu:~/python/tools$ python trans.py http://lovedboy.tk/lovedboy.txt thunder://QUFodHRwOi8vbG92ZWRib3kudGsvbG92ZWRib3kudHh0Wlo= flashget://W0ZMQVNIR0VUXWh0dHA6Ly9sb3ZlZGJveS50ay9sb3ZlZGJveS50eHRbRkxBU0hHRVRd& qqdl://aHR0cDovL2xvdmVkYm95LnRrL2xvdmVkYm95LnR4dA==
快车转普通地址
lovedboy@ubuntu:~/python/tools$ python trans.py 'flashget://W0ZMQVNIR0VUXWh0dHA6Ly9sb3ZlZGJveS50ay9sb3ZlZGJveS50eHRbRkxBU0hHRVRd&' http://lovedboy.tk/lovedboy.txt
旋风转普通地址:
lovedboy@ubuntu:~/python/tools$ python trans.py qqdl://aHR0cDovL2xvdmVkYm95LnRrL2xvdmVkYm95LnR4dA==
http://lovedboy.tk/lovedboy.txt
迅雷转普通地址:
lovedboy@ubuntu:~/python/tools$ python trans.py thunder://QUFodHRwOi8vbG92ZWRib3kudGsvbG92ZWRib3kudHh0Wlo=
http://lovedboy.tk/lovedboy.txt
也要转载也要注明原地址丫。我不求别的。
http://www.cnblogs.com/lovedboy/articles/2457470.html