迅雷,快车和qq下载都有专用的地址,其转换规则如下:
1、普通地址转换为迅雷地址 在原地址前面加”AA”,后面加”ZZ”(注:不包括引号),即AAhttp://**ZZ 然后用base64编码后,在地址前加thunder://. 2、普通地址转换为快车地址 在原地址前后都加上”[FLASHGET]“(注:不包括引号),地址变为 [FLASHGET]http://**[FLASHGET] 用base64编码后,在地址前加flashget://,后面还要加上”&字符串”,字符串随便什么都行. 3、普通地址转换为旋风地址 旋风相对就简单多了,将原地址直接base64编码,然后在地址前加qqdl:// 逆向及反着来一次.
python地址转换代码如下:
#! /usr/bin/env python # PyThunder.py # transfer special download address to the normal http address # including thunder, flashget and qq download # http://52xenos.blogspot.com from base64 import decodestring, encodestring def decThunder(strThu): """ Thunder decode """ if strThu.startswith('thunder://'): strHttp = strThu[strThu.index('thunder://')+len('thunder://'):] strHttp = decodestring(strHttp) if strHttp.startswith('AA') and strHttp.endswith('ZZ'): strHttp = strHttp[len('AA'):len(strHttp)-len('ZZ')] return strHttp else: return 'Wrong' else: return 'Wrong' def encThunder(strHttp): """ Thunder encode """ if strHttp.startswith('http://'): strThu = 'AA' + strHttp strThu += 'ZZ' strThu = encodestring(strThu) strThu = 'thunder://' + strThu return strThu else: return 'Wrong' def decFlash(strFla): """ Flashget decode """ if strFla.startswith('flashget://'): strHttp = strFla[strFla.index('flashget://')+len('flashget://'):strFla.index('&')] strHttp = decodestring(strHttp) if strHttp.startswith('[FLASHGET]') and strHttp.endswith('[FLASHGET]'): strHttp = strHttp[len('[FLASHGET]'):len(strHttp)-len('[FLASHGET]')] return strHttp else: return 'Wrong' else: return 'Wrong' def encFlash(strHttp): """ Flashget encode """ if strHttp.startswith('http://'): strFla = '[FLASHGET]' + strHttp + '[FLASHGET]' strFla = encodestring(strFla) strFla = 'flashget://' + strFla strFla += '&test' return strFla else: return 'Wrong' def decQQ(strQQ): """ QQdown decode """ if strQQ.startswith('qqdl://'): strHttp = strQQ[strQQ.index('qqdl://')+len('qqdl://'):] strHttp = decodestring(strQQ) return strHttp else: return 'Wrong' def encQQ(strHttp): """ QQdown encode """ if strHttp.startswith('http://'): strQQ = encodestring(strHttp) strQQ = 'qqdl://' + strQQ return strQQ else: return 'Wrong' def main(): """ main entry here """ while True: strFlag = raw_input("""Please input the type: 1 : other -> http 2 : http -> other 0 : exit\n""") if strFlag == '0': break elif strFlag == '1': print "You choose other->http" strOther = raw_input("""Please input the address:(0 for back)\n""") if strOther == '0': continue elif strOther.startswith('thunder://'): if decThunder(strOther) != 'Wrong': print decThunder(strOther) elif strOther.startswith('flashget://'): if decFlash(strOther) != 'Wrong': print decFlash(strOther) elif strOther.startswith('qqdl://'): if decQQ(strOther) != 'Wrong': print decQQ(strOther) elif strFlag == '2': print "You choose http->other" strType = raw_input("""Please specify the type: 1 : http->thunder 2 : http->flashget 3 : http->QQ down 0 : back\n""") if strType == '0': continue elif strType == '1': strHttp = raw_input("Please input the address:(0 for back)\n") if strHttp == '0': continue elif encThunder(strHttp) != 'Wrong': print encThunder(strHttp) elif strType == '2': strHttp = raw_input("Please input the address:(0 for back)\n") if strHttp == '0': continue elif encFlash(strHttp) != 'Wrong': print encFlash(strHttp) elif strType == '3': strHttp = raw_input("Please input the address:(0 for back)\n") if strHttp == '0': continue elif encQQ(strHttp) != 'Wrong': print encQQ(strHttp) #test module if __name__ == '__main__': main()
No comments :
Post a Comment