Jump to content

how to get data (name, speed, ID, ration, size, etc) from utorrent?


Recommended Posts

I have utorrent version 3.2, windows 7 and python compiler version 3.3.

I've read the entire section of the website http://www.utorrent.com/intl/en/community/developers/webapi # devs3.

My goal: it's get data of torrent link that is downloading (speed, status, size, etc).

I've tried to get the data (hash, status, progress, size, dl_speed, ul_speed, ratio, etc.) of torrent from utorrent.

I think that I have suitable tools such as a module in python called "requests" (newest version) to connect to http://localhost:32768/gui/token.html and I have a webUI too installed.

The python seems to do its job, but it doesn't get the data from utorrent that I want. I've read several other articles and I did not succeed to how to do that.

I can't read any information from utorrent and I doesn't get to list the torrents that are downloads.

I am beginner and very curious, I want to learn how to make a python program to get the data about torrent links that are downloaded on the utorrent.

Link to comment
Share on other sites

  • 1 month later...

I made the code below to gather torrent details

import requests
import json

# Pega a tokenID para autenticar o acesso aos dados estatísticos do utorrent
tokenID = requests.get('http://localhost:32768/gui/token.html', auth=('nano','xxx'))

#Parser para extrair somente o token
token = tokenID.text.split('>')[2].split('<')[0]

#Autenticação com user + senha + token
req = requests.get('http://localhost:32768/gui/', auth=('nano', 'xxx'), params={'list':'1','token':token})

When I've typed req.text on python console I get the message: "invalid request'

what is it going on?

Link to comment
Share on other sites

  • 4 weeks later...
My tokens always end with '=' which requests changes to an '%3D'

%3D is the hexadecimal ASCII code for the = sign and is converted because the = sign is ONLY allowed in URLs to delimit a key/value pair in URL parameters.



The conversion process is called URL Encoding, where all 'illegal' characters are converted to their hex equivalent,

Link to comment
Share on other sites

1) uTorrent server can handle both '=' and '3D%'

2) You are missing out the GUID cookie in your request. That's why you receive the 'invalid request' message.


import requests

req = requests.get('http://localhost:8080/gui/token.html', auth=('admin',''))

token = req.text.split('>')[2].split('<')[0]
guid = req.cookies['GUID']

cookies = dict(GUID = guid);

req = requests.get('http://localhost:8080/gui/', auth=('admin', ''), params={'list':'1','token':token}, cookies=cookies)

print req.text

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...