Jothay Posted March 3, 2013 Report Share Posted March 3, 2013 I'm trying to create an RSS magnet program in C#/WPF, unfortunately I can't see to get it to work. I am receiving 400 Invalid Request errors from the webui. This is a Linux 3.0 x86 install on a headless Ubuntu server.At first, I thought it was that I wasn't including tokens, because I wasn't, but even after adding them it's still not working. The token is at the front so it shouldn't be crapping on its position. I'll be making the UI for customizing field values later, I just need it functional first.string scheme = "http://";string server = "192.168.1.80";string port = "8080";string relativePath = "/gui/";string tokenPath = scheme + server + ":" + port + relativePath + "token.html";foreach (FeedItem item in LV_Parsed.SelectedItems){ WebClient tokenClient = new WebClient(); tokenClient.Credentials = new NetworkCredential("admin", "*ThePassword"); string tokenClientResponse = tokenClient.DownloadString(tokenPath); string token = tokenClientResponse .Replace("<html><div id='token' style='display:none;'>", "") .Replace("</div></html>", ""); token = HttpUtility.UrlEncode(token); // token value: n1nzpboWiGxVxqEs1VOTrxUoT3woSMsFAAAAAM8MYqEAAAAAw1gp4hefM1EAAAAA string magnet = "magnet:?xt=urn:btih:"; string dumbName = item.Title; string hash = item.Link.Replace("http://torrentz.eu/", ""); string path = scheme + server + ":" + port + relativePath + "?token=" + token + "&action=add-url&s=" + HttpUtility.UrlEncode(magnet + hash + "&dn=" + dumbName); string addResult = tokenClient.DownloadString(path); addResult += ""; /* Path's Value (separated to make it easier to read): http://192.168.1.80:8080/gui/ ?token=n1nzpboWiGxVxqEs1VOTrxUoT3woSMsFAAAAAM8MYqEAAAAAw1gp4hefM1EAAAAA &action=add-url &s=magnet%3a%3fxt%3durn%3abtih%3a50ad62001d608b4e6abf1a6fbdfab57e4888888b %26dn%3dThe+Torrent+Title*/} Link to comment Share on other sites More sharing options...
Kitsoran Posted March 5, 2013 Report Share Posted March 5, 2013 This is probably wrong, but have you tried also handling cookies from the webui? Link to comment Share on other sites More sharing options...
Jothay Posted March 5, 2013 Author Report Share Posted March 5, 2013 Umm, do you have a direct link to something that explains how to implement cookies? I can't find one in this forum that goes over it after searching for 20 minutes :/ Link to comment Share on other sites More sharing options...
Jothay Posted March 5, 2013 Author Report Share Posted March 5, 2013 Just in case it has any bearing, this is what the About dialog in the web ui tells me. If I need a newer version of webui I need to know how to install it to UbuntuµTorrent ServerCopyright 2011 BitTorrent, Inc.All Rights Reserved.Client InformationProduct Version 3.0Source Revision 27079Build Date 2012-04-17 19:51:48 -0700UI Revision 27079Peer ID UT300BUser-agent uTorrent/300B(27079)(server)UPnP external address: 192.168.0.3:54143(TCP)/54143(UDP)This was installed using the installer on this page:http://www.utorrent.com/downloads/linuxSeeing as it was released almost a year ago, I'm betting its in some way out of date :/ Link to comment Share on other sites More sharing options...
Jothay Posted March 5, 2013 Author Report Share Posted March 5, 2013 So I turned off token auth in the advanced settings (not realizing there were multiple pages, probably because I'm an idjit), took the token part out of the path, now it just takes the magnet and works... Link to comment Share on other sites More sharing options...
Kitsoran Posted March 17, 2013 Report Share Posted March 17, 2013 You would just return the cookie, if that is the issue. How you would do so in your chosen programming language, I do not know. Link to comment Share on other sites More sharing options...
lithopsian Posted May 16, 2013 Report Share Posted May 16, 2013 Cookies are always a good one but it sounds like you've narrowed it down to a token issue. I don't believe you are extracting the correct token value. A token will have an equals sign on the end. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.