python 批量下载种子_批量下载btbbt种子

好多BT没有打包成一个种子,一集集下载很烦的说,还有一大堆广告

import json

from urllib import parse

import requests

import os

import time

from bs4 import BeautifulSoup as BS

import urllib.request

webroot="http://www.btbtt.me/"

url = 'http://www.btbtt.me/thread-index-fid-950-tid-4435716.htm'

requests.packages.urllib3.disable_warnings() # 忽视网页安全性问题

r = requests.get(url, verify=False) # 不验证证书

r.encoding = 'utf8'

soup = BS(r.text, 'html.parser')

headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'}

attatchpage=soup.find_all('div',class_='attachlist')

for i in attatchpage:

#print(i)

for j in i.find_all('a'):

downloadurl=j.get('href')

# print(j.get('href'))

r2=requests.get(webroot+j.get('href'), verify=False)

downpage=BS(r2.text,'html.parser')

want5=downpage.find('div',id='body')

filename=want5.select('dd')

imgpath='d:/python/code/down/'+filename[0].text.strip()

for k in want5.find_all('a'):

print(imgpath)

if not os.path.exists(imgpath):

response = requests.get(webroot+k.get('href'),headers=headers)

with open(imgpath, 'wb') as f:

f.write(response.content)

f.flush()

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值