I am trying to get the peer list from the trackers using https://wiki.theory.org/BitTorrent_Tracker_Protocol
But most of the torrent files available on the net use a udp
tracker. The above website is for HTTP trackers. The torrent files with HTTP based trackers give an error.(Passkey error , or hash error or user error or 404 not found response
)
Right now my request code for all HTTP trackers look like :
payload = urllib.urlencode(payload)
for ann in self.torrent.announce_list:
if("udp" not in ann[0]):
url = ann[0]
print "Encoded Request URL :",(url + "?" + payload)
print "Requesting Tracker for Peer List"
try:
response = urllib.urlopen(url + "?" + payload).read()
print "RESPONSE :",response
except Exception, e:
print e
I have crosschecked my request URL against the requests being made by uTorrent using wireshark. They all match. The info-hash is being generated correctly.
How do I retrieve the peer list from UDP as well as HTTP trackers ? I am trying not to use any external library like lib-torrent. Some guidance would be really helpful.
The following code worked for me. Calling announce_udp() with the tracker URL and the payload dictionary with all the URL parameeters.