Jump to content

What am I doing wrong? (adding magnet links via WebUI API)


Frustrated Enthusiast

Recommended Posts

I'm working on a script and keep running into a silly issue.

When I go to add a magnet link via the WebUI API the magnet link adds successfully but no trackers associated with the torrent show up. The reason is that the tracker information stored in the magnet link is not seen as part of the query being passed to the WebUI API.

Say I have the following (bogus, obviously) magnet link:

magnet:?xt=urn:btih:a187011af71853cfd9acfacbb9b85a2d06575f39&

tr=http://tracker1.com/announce&tr=http://tracker2.com&tr=http://tracker3.com

So I do the following WebUI API call:

http://username:password@server/gui/?action=add-url&s=magnet:?xt=urn:btih:a187011af71853cfd9acfacbb9b85a2d06575f39&

tr=http://tracker1.com/announce&tr=http://tracker2.com&tr=http://tracker3.com

The WebUI API sees:

?action=add-url

&s=magnet:?xt=urn:btih:a187011af71853cfd9acfacbb9b85a2d06575f39

&tr=http://tracker1.com/announce

&tr=http://tracker2.com

&tr=http://tracker3.com

instead of the desired behaviour, which is to include the trackers in the "s" query variable.

Of course the API's behaviour here is correct and mine is wrong. This is a total brain fart thing, I'm sure I'll figure this out two minutes after I post. I know I've gotta escape or convert those the ampersands somehow. The script I'm writing is in PHP.

Can anyone steer me in the right direction?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...