Because I have nothing to do, I’m going to look for a movie to see. Then I found the seed search site, but this kind of website has too many pop-up ads, which makes me very tired. So I wanted to write a script in Python to automatically get magnetic links.
It took about half an hour.
The code is as follows
import requests
import re
from bs4 import BeautifulSoup
Url = * seed's website * / "
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": "* seed's website *",
"Referer": "* seed's website * /",
"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 ("* seed's website * /. * \. 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 ("Name:" torrent [item] [0])
Print ("published on:" torrent [item] [1])
Print ("size:" torrent [item] [2])
Print ("heat:" torrent [item] [3])
Print ("magnetic link:", torrent [item] [4], '\ n')
The results are as follows
The above Python automatic access to seed magnetic link method is the small editor to share all the content, I hope to give you a reference, also hope you can support developeppaer.