Archived

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

kentyman

uTorrent Bookmarklet, or "Add new torrents from your iPhone"

Recommended Posts

Hi guys, I have been playing around with the bookmarklet for a few days but I am having problems with the cookie (userid & pass) for private trackers.

I have successfully managed to get 3 sites working by grabbing the userid and passkey from the cookies but I have another 3 sites that i tried to add using the same process and they just refuse to add the torrents via the bookmarklet. I am not sure what the rules are regarding naming sites so I will refrain from mentioning them unless its ok to do so...(ok i am just going follow what's already been said in this thread). Is this something that could possibly be fixed in the code or would it more likely be with the sites themselves or utorrent..

Cheers

Fush

Edit: ok I have no idea why its going wrong now...there are my results so far...

Works

Bitme/Bitmetv/Torrent-damage

http://DOMAIN/download.php/ID/NAME_OF_THE_TORRENT.torrent

Torrentbytes

Fails with Bookmarklet but works when add from URL is used in Utorrent with cookies

http://DOMAIN/download.php?id=ID&name=NAME_OF_THE_TORRENT.torrent

What CD

Fails with Bookmarklet but works when add from URL is used in Utorrent (does not need cookie, have tried with and without cookie no change)

http://DOMAIN/torrents.php?action=download&id=ID&authkey=AUTHKEY&torrent_pass=PASSKEY

Waffles

Fails (could be possible redirect issue, it appears to try and go to an https:// addy)

http://DOMAIN/download.php/uid/ID/NAME_OF_THE_TORRENT.torrent

edit2: here is the code i am using...UID's and Pass' have been changed

javascript:(function() { var host = "http://admin:password@www.url.net:6666/gui/"; for (var i = 0; i < document.links.length; i++) { document.links[i].href = "javascript:(function() { var img = document.createElement('img'); img.setAttribute('src', '"+ host + "?action=add-url&s=" + encodeURIComponent(document.links[i].href) + (document.links[i].href.match(/bitmetv/i) ? ":COOKIE:uid=55XXX;pass=1e47fc219ceXXXXXXXXXXXXXXXX" : "") + (document.links[i].href.match(/bitme.org/i) ? ":COOKIE:uid=10XXXX;pass=bbb65747e2cXXXXXXXXXXXXXXXXXXXXX" : "") + (document.links[i].href.match(/torrent-damage/i) ? ":COOKIE:uid=22XXXX;pass=c5b354dXXXXXXXXXXXXXXXXXXXX" : "") + (document.links[i].href.match(/torrentbytes/i) ? ":cookie:uid=1XXXX;pass=bd39d370eb3XXXXXXXXXXXXXXX" : "") + (document.links[i].href.match(/waffles.fm/i) ? ":COOKIE:uid=2XXXX;pass=5148dfb963a1XXXXXXXXXXXXXXXX" : "") + (document.links[i].href.match(/what.cd/i) ? ":COOKIE:uid=2XXXX;pass=5e3d7024244c24XXXXXXXXXXXXXXXX" : "") + "'); img.setAttribute('style', 'visibility:hidden'); document.body.appendChild(img); setTimeout('window.open(\"" + host + (navigator.userAgent.match(/iP(hone|od)/i) ? "iphone/i.html" : "") + "\", \"_self\");', 4000); })();"; } })();

Share this post


Link to post
Share on other sites

Im also not having much luck with the cookie (userid & pass) method for private trackers. :(

is there anyway, instead of using the cookie etc that the bookmarklet could include your passkey??

I found, on one private tracker anyway, that by adding my passkey after the .torrent url (&passkey=[passkey] as below) the passkey worked and the download was started.

hxxp://www.privatetracker.org/download.php?id=29782&name=Torrentdownload.INTERNAL.torrent&passkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Ive no idea if its at all possible, as im no programmer, hopefully someone could let me know though ;)

Share this post


Link to post
Share on other sites

This is so stupidly convenient I can't even tell you :D

Any ideas how I'd go about editing the js to allow for an HTTPS (SSL) connection instead?

Share this post


Link to post
Share on other sites

I suppose I should have been a little more specific, sorry about that.

Yes, I'd like to connect to a private tracker, with the cookie uid/pass code from above, using https://blah.blah.blah... But the only http I see in the script is in reference to my destination home PC, I couldn't figure out how to change the connection to the tracker. Perhaps I'm missing something blatantly obvious (something to do with ssl and cookies?), I'm sure it wouldn't be the first time :)

Share this post


Link to post
Share on other sites

Earlier in this thread I mention how to add support for private trackers. I actually have a version of that generator page that supports it, but haven't posted it yet.

Share this post


Link to post
Share on other sites

Thanks for the reply kentyman,

Indeed, I am using your code, minus the delayed redirect, (shown below, and again, super helpful)... but when I browse via https:// to my tracker, the script doesn't seem to send the torrent to my home PC. If I connect via http:// the script works great. It's not something that is life or death but I, and the private tracker, prefer to have my sessions encrypted if at all possible.

javascript:(function() { var host = "http://MY_INFO_HERE/gui/"; for (var i = 0; i < document.links.length; i++) { document.links[i].href = "javascript:(function() { var img = document.createElement('img'); img.setAttribute('src', '"+ host + "?action=add-url&s=" + encodeURIComponent(document.links[i].href) + (document.links[i].href.match(/PRIVATE_DOMAIN/i) ? ":COOKIE:uid=SOME_INTEGER;pass=SOME_LONG_STRING" : "") + "'); img.setAttribute('style', 'visibility:hidden'); document.body.appendChild(img); })();"; } })();

Thanks again,

bcode

Share this post


Link to post
Share on other sites

:) Yup, I definitely have the right cookie and uid info, as mentioned, the script works flawlessly when I visit the site over http.

I was thinking perhaps the SSL connection isn't using the stored cookie info and is using a private session identifier, which is why the script isn't working?.. I have no real info to back that up, just a guess based on my limited knowledge of the protocol.

P.S. Thanks for the new bookmarklette creator... it's exactly what I was hoping for.

Share this post


Link to post
Share on other sites

Perhaps the SSL connection uses different cookie, and therefore a different pass? Maybe search for more information about the COOKIE stuff. I haven't run into the problem you're having.

Share this post


Link to post
Share on other sites

@Ockingshay:

That link is the bookmarklet. Bookmark that link. Then, before clicking a link to a torrent file, click that link, and instead of trying to download the torrent locally, it will be forwarded to your remote client.

Share this post


Link to post
Share on other sites

sorry, i've only just got my iphone, so struggling with it all atm....

how do i bookmark that link? If i click the "+" it just bookmarks ur page.

Share this post


Link to post
Share on other sites

Ah, I see now. You cannot bookmark bookmarklets from your iPhone, since they're just Javascript instead of actual URLs.

What you need to do is bookmark it from your home web browser, and sync that to your phone.

Share this post


Link to post
Share on other sites

Thanks for your help, I got it synched but just have a few questions:

1) When it redirects to my webui it is putting /web/ on the end of the address, so it doesn't load the page

username:password@IP:PORT/gui/web/ - what is this web part? do i need t, can it be removed?

2) Just to confirm for private trackers...in this example i'm using torrentleech, on your creator i put:

Domain = torrentleech.org..... should i be putting that or if i look at a torrent properties in webui it gives me:

http://tracker.torrentleech.org:2710/a/MY PASS CODE/announce

should i put the domain as http://tracker.torrentleech.org or http://tracker.torrentleech.org:2710

For Black-Cats i get http://www.blackcats-games.net:2228/MY PASS CODE/announce

should i put http://www.blackcats-games.net or http://www.blackcats-games.net:2228

Thanks for all ur help so far

Share this post


Link to post
Share on other sites

1. The "web/" addition was an error in the case of uTorrent. It should now only do that for Transmission.

2. For domain you only need to put "torrentleech.org".

Share this post


Link to post
Share on other sites

thanks for that, the change has worked...is it worth making it /gui/iphone/i.html so that it defaults to the iphone gui that i presume this was designed for? Also can you add more lines to the private tracker section on your creator? 10 perhaps?

Everything seems to work except the torrent is never added...

I click on my bookmarklet, click on the .torrent file and it forwards me to my iphone webui, but then nothing happens.

Am i missing something?

This is my code:

javascript:(function()%20{%20var%20host%20=%20"http://MYIP:PORT/gui/iphone/i.html";%20for%20(var%20i%20=%200;%20i%20<%20document.links.length;%20i++)%20{%20document.links.href%20=%20"javascript:(function()%20{%20var%20img%20=%20document.createElement('img');%20img.setAttribute('src',%20'"+%20host%20+%20"?action=add-url&s="%20+%20encodeURIComponent(document.links.href)%20+%20(document.links.href.match(/torrentleech\.org/i)%20?%20":COOKIE:uid=ockingshay;pass=MYPASSCODE"%20:%20"")%20+%20(document.links.href.match(/blackcats-games\.net/i)%20?%20":COOKIE:uid=ockingshay;pass=MYPASSCODE"%20:%20"")%20+%20(document.links.href.match(/what\.cd/i)%20?%20":COOKIE:uid=ockingshay;pass=MYPASSCODE"%20:%20"")%20+%20"');%20img.setAttribute('style',%20'visibility:hidden');%20document.body.appendChild(img);%20setTimeout('window.open(\""%20+%20host%20+%20"\",%20\"_self\");',%204000);%20})();";%20}%20})();

Share this post


Link to post
Share on other sites

I used to have it forward to the iPhone GUI, but since I don't use uTorrent anymore I didn't know whether that was still the right thing to do. Does the main GUI not yet work on the iPhone?

You're not using the :COOKIE: feature right. Your uid and pass are not your username and password on the site. Please see the documentation for the :COOKIE: feature.

Share this post


Link to post
Share on other sites

the main webui does work but it's not very good as the page doesn't load properly. The iphone web gui is much better.

BUT:

thank you muchly for your patience, i have gotten it to work! hoorah

Share this post


Link to post
Share on other sites