已失效
今天想下电影,发现BT天堂上的资源还挺全的,但是有个问题,想下个电影,需要经过好几个步骤,略显麻烦,索性自己用Python把全站的种子全部爬下来,现分享出来。种子更新截止到今天,2015-12-05.
一共5.46G,88430项。
屏幕快照 2015-12-05 20.12.09.png
基本全站的种子全在了,包括各种清晰度的,从名字可以看出来。种子可以直接用迅雷打开,下载。
屏幕快照 2015-12-05 19.41.16.png 屏幕快照 2015-12-05 19.44.15.png
程序代码:
import requests, bs4, re, os
from multiprocessing import Pool
def getPayload(url):
r = requests.get(url)
r.encoding = 'utf-8'
soup = bs4.BeautifulSoup(r.text, 'lxml')
#print(soup)
tinfos = soup.find_all('div', class_='tinfo')
#print(tinfos)
for tinfo in tinfos:
href = tinfo.a['href']
if (href != 'http://www.xunleigang.com'):
#downloadTorrent
href = dict(i.split('=') for i in tinfo.a['href'].split('&'))
title = tinfo.a['title']
id = href['id']
uhash = href['uhash']
payload = {'action':'download', 'imageField.x':'66', 'imageField.y':'40', 'id':id, 'uhash':uhash}
title = title.replace('.', '_').replace('/', '_')
#print(title)
r = requests.post('http://www.bttiantang.com/download2.php', data = payload)
with open(title + '.torrent', 'wb+') as f:
f.write(r.content)
def downloadTorrent(payload):
'''kw = 'action=download&id=27442&uhash=9c608887ce5de16995467b53&imageField.x=66&imageField.y=40'
payload = dict(i.split('=') for i in kw.split('&'))
print(payload)'''
href = payload['href']
href = dict(i.split('=') for i in href.split('&'))
title = payload['name']
#title.replace(' ', '')
id = href['id']
uhash = href['uhash']
payload = {'action':'download', 'imageField.x':'66', 'imageField.y':'40', 'id':id, 'uhash':uhash}
#print(payload)
title = title.replace('.', '_').replace('/', '_')
#print(title)
r = requests.post('http://www.bttiantang.com/download2.php', data = payload)
with open(title + '.torrent', 'wb+') as f:
f.write(r.content)
def getUrls(i):
url = 'http://www.bttiantang.com/?PageNo=' + str(i)
r = requests.get(url)
soup = bs4.BeautifulSoup(r.text, 'lxml')
#print(soup)
urllist = []
urls = soup.find_all('p', class_="tt cl")
for i in urls:
#print('http://www.bttiantang.com/%s, %s'%(i.a['href'],i.b.text))
url = 'http://www.bttiantang.com/' + i.a['href']
#print(url)
urllist.append(url)
return urllist
def main():
if(os.path.exists('torrent')):
os.chdir('torrent')
else:
os.mkdir('torrent')
os.chdir('torrent')
for i in range(1, 712):
urllist = getUrls(i)
print(urllist)
#urllist = getUrls()
p = Pool(4)
p.map(getPayload, urllist)
p.close()
p.join()
if __name__ == '__main__':
main()
下载链接:百度云
密码:请关注公众号lyishaou,回复“BT天堂”
微信公众号:lyishaou
微信公众号
网友评论