I have a torrent hash from the magnet link. For example: fda164e7af470f83ea699a529845a9353cc26576 When I try to get information about leechers and peers I should request: http://tracker.publicbt.com/scrape?info_hash=??? How should I convert info hash for this request? Is it url encoding or becoding? how? In PHP.
+1
A:
It's a raw hexadecimal representation. Use pack()
with H
to convert it. Then URL encode it.
Ignacio Vazquez-Abrams
2010-07-17 15:55:24
A:
The info_hash is always url-safe, you need not encode or escape it in any way. It is actually an md5 of the torrent file's header.
Maerlyn
2010-07-17 16:29:07
The info_hash is the urlencoded 20-byte **SHA1 hash** *(not md5)* of the value of the info key from the Metainfo file
Alexandre Jasmin
2010-07-21 03:14:27
A:
Got this python snippet from a colleague,
r = ''
s = 'fda164e7af470f83ea699a529845a9353cc26576'
for n in range(0, len(s), 2):
r += '%%%s' % s[n:n+2].upper()
print r
Output: %FD%A1%64%E7%AF%47%0F%83%EA%69%9A%52%98%45%A9%35%3C%C2%65%76
Works like a charm.
Edit: Works like a charm for getting the tracker to give back status 200 (ok) but still doesn't work for retrieving the torrent details...
Lundberg
2010-08-31 14:42:44