迅雷和qq旋风下载,有加速和离线功能,很方面,我是在网上看到的原始地址和迅雷地址,qq旋风地址的转化原理,然后用python+pyqt写了一个客户端
原理:
迅雷: 迅雷下载地址="thunder://"+Base64编码("AA"+"真实地址"+"ZZ")
QQ旋风: qqdl="qqdl://"+Base64编码("真实地址")
import re import base64 from PyQt4 import QtGui,QtCore import os import sys class Window(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.linklabel=QtGui.QLabel(‘link:‘,self) self.link=QtGui.QLineEdit(self) self.thunderlabel=QtGui.QLabel(‘Thunder:‘,self) self.thunder=QtGui.QLineEdit(self) self.qqdllabel=QtGui.QLabel(‘qqdl‘,self) self.qqdl=QtGui.QLineEdit(self) transbutton=QtGui.QPushButton(‘Transition‘,self) grid=QtGui.QGridLayout() grid.addWidget(self.linklabel) grid.addWidget(self.link) grid.addWidget(self.thunderlabel) grid.addWidget(self.thunder) grid.addWidget(self.qqdllabel) grid.addWidget(self.qqdl) grid.addWidget(transbutton) self.resize(500,200) self.setLayout(grid) self.setWindowTitle(‘Transition by loster v0.1‘) self.connect(transbutton,QtCore.SIGNAL(‘clicked()‘),Trans) def getUrl(self): return self.link.text() def setThunder(self,url): self.thunder.setText(url) def setQQDL(self,url): self.qqdl.setText(url) def setError(self,warning): QtGui.QMessageBox.warning( self, "Transition", warning, QtGui.QMessageBox.Yes ) def Trans(): #获得链接 url=main.getUrl() print ‘url:‘+url if CheckUrl(url): main.setThunder(Url2Thunder(url)) main.setQQDL(Url2QQdl(url)) else: main.setError(‘Invalid link,Please try again‘) #判断url是否有效 def CheckUrl(url): if re.match(‘(http|https|ftp|ed2k)://‘, url): return True else: return False #转化成迅雷下载地址 def Url2Thunder(url): url=‘AA‘+url+‘ZZ‘ url = base64.b64encode(url) url = ‘thunder://‘ + url print ‘thunder:‘+url return url #转换成qq旋风下载地址 def Url2QQdl(url): url = base64.b64encode(url) url = ‘qqdl://‘ + url print ‘QQDL:‘+url return url if __name__==‘__main__‘: app=QtGui.QApplication(sys.argv) main=Window() main.show() sys.exit(app.exec_())
源码下载:https://github.com/iloster/UrlTransition
python将下载地址转换成迅雷和qq旋风的下载地址,布布扣,bubuko.com
原文:http://blog.csdn.net/iloster/article/details/24588029