python下载迅雷资源_PYTHON实现迅雷、FLASHGET、QQ旋风转真实链接、磁链转种子文件、迅雷快传链接抓取 | 学步园...

# -*- coding: utf-8 -*-

import re;

import urllib2;

import os;

import base64;

def get_kuaichuan_url(src_url):

kuaichuan_re='.*?)"\stitle=".*?"\sfile_size=".*?"\starget=".*?">.*?';

req=urllib2.Request(src_url);

req.add_header("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4")

resp=urllib2.urlopen(req).read();

found=re.finditer(kuaichuan_re,resp,re.S);

for url in found:

print '快传链接';

print url.group('url');

print '\n';

def get_qq_url(src_url):

print 'qq转真实链接:'

url=src_url[7:len(src_url)];

real_url=base64.decodestring(url);

print real_url;

def get_thunder_url(src_url):

print 'thunder转真实链接:'

url=src_url[10:len(src_url)]

tmp_url=base64.decodestring(url);

real_url=tmp_url[2:len(tmp_url)-2];

print real_url;

def get_flash_get(src_url):

print 'flashget转真实链接:';

url=src_url[11:len(src_url)];

tmp_url=base64.decodestring(url);

real_url=tmp_url[10:len(tmp_url)-10]

#print tmp_url;

print real_url;

def magnet_to_torrent(src_url):

print '磁链转种子:';

url=src_url[20:];

tmp_url=url.upper();

real_url='http://bt.box.n0808.com/'+tmp_url[0:2]+'/'+tmp_url[len(tmp_url)-2:]+'/'+tmp_url+'.torrent';

#print url;

print real_url;

#magnet:?xt=urn:btih:f8181597b51c157fb470e5ee236e364c6fbc2af2

#Thunder://QUFodHRwOi8vaW0uYmFpZHUuY29tL2luc3RhbGwvQmFpZHVIaS5leGVaWg==

#Flashget://W0ZMQVNIR0VUXWh0dHA6Ly9pbS5iYWlkdS5jb20vaW5zdGFsbC9CYWlkdUhpLmV4ZVtGTEFTSEdFVF0=&yinbing1986

#qqdl://aHR0cDovL2ltLmJhaWR1LmNvbS9pbnN0YWxsL0JhaWR1SGkuZXhl

#http://kuai.xunlei.com/d/uKx8AAJlFgBh3khS998

def choose_method(src_url):

myurl=src_url.lower();

thunder_re='thunder://.*?==';

qq_re="qqdl://.*?";

flashget_re='flashget://.*?';

kuaichuan_re='http://kuai.xunlei.com/.*?';

magnet_re='magnet:\?xt=urn:btih:.*?';

if re.search(thunder_re,myurl):

get_thunder_url(src_url);

elif re.search(qq_re,myurl):

get_qq_url(src_url);

elif re.search(flashget_re,myurl):

get_flash_get(src_url);

elif re.search(kuaichuan_re,myurl):

get_kuaichuan_url(src_url);

elif re.search(magnet_re,myurl):

magnet_to_torrent(src_url);

else:

print '链接不在转换范围内';

if __name__=='__main__':

src_url=raw_input(u'url:');

choose_method(src_url);

也不知自己前段时间干嘛了,居然没有更新博客...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值