Chinaunix首页 | 论坛 | 博客
  • 博客访问: 68417
  • 博文数量: 13
  • 博客积分: 197
  • 博客等级: 入伍新兵
  • 技术积分: 140
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-22 17:54
文章分类

全部博文(13)

文章存档

2011年(13)

分类: Python/Ruby

2011-06-03 15:49:16

QQ旋风有离线下载的功能,迅雷离线下载我还要付费,所以选择用QQ离线下载,需要速度快的用迅雷,经常在这两个下载工具间切换,有些地址是它们自有的,索性写个小程序转换下,功能简单,没做什么容错处理
  1. #-*- coding:utf-8 -*-
  2. import sys
  3. import base64
  4. from PyQt4 import QtCore,QtGui

  5. class MyWindow(QtGui.QWidget):
  6.     def __init__(self):
  7.         QtGui.QWidget.__init__(self)
  8.         self.setWindowTitle(u'专用下载地址解码')
  9.         #self.resize(300,200)
  10.         self.setFixedSize(300,200)
  11.         vbox=QtGui.QVBoxLayout()
  12.         self.inputbox=QtGui.QTextEdit()
  13.         vbox.addWidget(self.inputbox)
  14.         hbox=QtGui.QHBoxLayout()
  15.         self.decodebtn=QtGui.QPushButton(u'迅雷链接转换网址')
  16.         self.connect(self.decodebtn, QtCore.SIGNAL('clicked()'),self.OnThunderDecode)
  17.         hbox.addWidget(self.decodebtn)
  18.         self.codebtn=QtGui.QPushButton(u'旋风链接转换网址')
  19.         self.connect(self.codebtn,QtCore.SIGNAL('clicked()'),self.OnTencentCode)
  20.         hbox.addWidget(self.codebtn)
  21.         vbox.addLayout(hbox)
  22.         self.outputbox=QtGui.QTextEdit()
  23.         vbox.addWidget(self.outputbox)
  24.         self.setLayout(vbox)
  25.         
  26.     def OnThunderDecode(self):
  27.         thunderurl=self.inputbox.toPlainText()
  28.         url=thunderurl.split('://')
  29.         realurl=base64.decodestring(url[1])
  30.         realurl=realurl[2:-2]
  31.         self.outputbox.setText(unicode(realurl,'cp936'))
  32.     
  33.     def OnTencentCode(self):
  34.         qurl=self.inputbox.toPlainText()
  35.         url=qurl.split('://')
  36.         self.outputbox.setText(unicode(base64.decodestring(url[1]),'cp936'))
  37.     
  38.         
  39.         


  40. if __name__=='__main__':
  41.     app=QtGui.QApplication(sys.argv)
  42.     window=MyWindow()
  43.     window.show()
  44.     app.exec_()
阅读(2443) | 评论(0) | 转发(0) |
0

上一篇:Linux下IO复用用并发服务器模型

下一篇:没有了

给主人留下些什么吧!~~