Python 实现自动获取种子磁力链接方式
作者:锦城花开 时间:2022-12-19 16:17:31
因为我闲来无事,所以准备找一部电影来看看。 然后我找到了种子搜索网站,可是这类网站的弹窗广告太多,搞得我很烦。所以我就想着自己用python写一个自动获取磁力链接的脚本。
整个大概写了半个小时。
代码如下
import requests
import re
from bs4 import BeautifulSoup
url="*种子的网站*/"
header={
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Encoding":"gzip, deflate",
"Accept-Language":"zh-CN,zh;q=0.8",
"Cache-Control":"max-age=0",
"Connection":"keep-alive",
"Content-Length":"65",
"Content-Type":"application/x-www-form-urlencoded",
"Host":"btkitty.bid",
"Origin":"*种子的网站*",
"Referer":"*种子的网站*/",
"Upgrade-Insecure-Requests":"1",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0.14393; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2950.5 Safari/537.36"
}
while True:
word=input("输入搜索关键词:")
data={
"keyword":word,
"hidden":"true"
}
res=requests.post(url,data=data,headers=header)
bs=BeautifulSoup(res.text,"lxml")
itemInfo=bs.find_all("dd",class_="option")
torrent={}
for item in itemInfo:
magnet=item.find_next("a",href=re.compile("magnet.*")).attrs["href"]
name=item.find_previous("a",href=re.compile("*种子的网站*/.*\.html")).text
size=item.find_next(text=re.compile("\u6587\u4ef6\u5927\u5c0f")).find_next("b").text
time=item.find_next(text=re.compile("\u6536\u5f55\u65f6\u95f4")).find_next("b").text
hot=item.find_next(text=re.compile("\u4eba\u6c14")).find_next("b").text
torrent[name]=[name,time,size,hot,magnet]
for item in torrent:
print("名称:",torrent[item][0])
print("发布时间:",torrent[item][1])
print("大小:",torrent[item][2])
print("热度:",torrent[item][3])
print("磁力链接:",torrent[item][4],'\n')
运行结果如下
来源:https://blog.csdn.net/tony_eecs/article/details/58046230
标签:Python,种子,磁力链接
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
通过python读取txt文件和绘制柱形图的实现代码
2023-11-23 11:24:43
![](https://img.aspxhome.com/file/2023/1/97331_0s.png)
python性能测试手机号验证码登录压测示例详解
2021-06-05 13:21:25
设置jupyter中DataFrame的显示限制方式
2022-09-17 17:28:57
python的turtle库使用详解
2023-07-09 02:38:17
![](https://img.aspxhome.com/file/2023/8/72858_0s.png)
AJAX:如何处理书签和后退按钮
2008-03-21 18:44:00
javascript判断一个元素是否数组
2009-07-31 12:48:00
Python实现的绘制三维双螺旋线图形功能示例
2023-02-21 20:37:15
![](https://img.aspxhome.com/file/2023/4/96924_0s.png)
如何用python批量发送工资条邮件
2021-03-07 10:53:09
![](https://img.aspxhome.com/file/2023/5/86455_0s.png)
python-docx 页面设置详解
2021-12-06 03:42:02
![](https://img.aspxhome.com/file/2023/1/76081_0s.png)
中秋阴天看不见月亮只好用python写赏月工具
2021-02-09 17:54:24
![](https://img.aspxhome.com/file/2023/3/96453_0s.gif)
python 计算方位角实例(根据两点的坐标计算)
2023-08-01 09:30:54
Python 利用Entrez库筛选下载PubMed文献摘要的示例
2021-05-27 11:35:01
![](https://img.aspxhome.com/file/2023/4/93744_0s.png)
sqlserver 多表查询不同数据库服务器上的表
2012-04-13 11:41:51
关于textarea的直观换行
2010-03-18 15:59:00
Python三维绘图之Matplotlib库的使用方法
2023-01-22 02:02:04
![](https://img.aspxhome.com/file/2023/7/95457_0s.png)
python函数参数*args**kwargs用法实例
2021-03-25 14:19:41
![](https://img.aspxhome.com/file/2023/3/80463_0s.png)
asp三天学好ADO对象之第二天
2008-10-09 12:49:00
python函数的重新定义及练习
2023-10-12 22:47:55
![](https://img.aspxhome.com/file/2023/8/63528_0s.png)
详解python时间模块中的datetime模块
2023-09-26 02:41:28
Python利用Redis计算经纬度距离案例
2021-03-05 04:51:35