Answer the question
In order to leave comments, you need to log in
How to “magnetize” and put a torrent on the jump?
Greetings, in general, I’m trying to implement the option with a torrent jump, but I’m stuck on how to magnetize using python, the code below receives a magnet link when you click on which the torrent starts
url = 'http://nnm-club.name/forum/viewtopic.php?t=1174513'
res = requests.get(url).text
s = BeautifulSoup(res, "lxml")
magnit = s.find('a', title='Примагнититься').get('href')
print(magnit)
Answer the question
In order to leave comments, you need to log in
This is how it works:
import requests
from bs4 import *
URL = 'http://nnm-club.name/forum/login.php'
USERNAME = 'user'
PASSWORD = 'pass'
TIMEOUT = 30.0
HEADERS = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
s = requests.Session()
s.headers.update(HEADERS)
s.params.update({'timeout': TIMEOUT})
login_data = {'username': USERNAME, 'password': PASSWORD, 'login': 'Вход'}
response = s.post(URL, data=login_data)
if USERNAME not in response.text:
print('Invalid username or password !!!')
else:
urlArrow = 'http://nnm-club.name/forum/viewtopic.php?t=1174513'
resArrow = s.get(urlArrow).text
Arrow = BeautifulSoup(resArrow, "lxml")
torrent_link = 'http://nnm-club.name/forum/' + Arrow.find('a', text='Скачать').get('href')
magnet_link = Arrow.find('a', title='Примагнититься').get('href')
print(f'\nTorrent link: {torrent_link}\nMagnet link: {magnet_link}')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question