D
D
Dmitry2017-10-16 16:02:07
Python
Dmitry, 2017-10-16 16:02:07

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)

I don't understand how to do this in python, can you help me?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Ivanov, 2017-10-17
@ipatov_dn

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}')

D
Dimonchik, 2017-10-16
@dimonchik2013

Chrome + F12 + Networking
or Fiddler

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question