-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
Can you please check for trackers that support hybrid torrent and list them.
My python knowledge is basic but you may be able to do something like this.
from tornado.httpclient import AsyncHTTPClient, HTTPRequest
import bencodepy
import binascii
import urllib.parse
import asyncio
async def check_bep34_support(tracker_url, info_hash_hex):
info_hash_bytes = binascii.unhexlify(info_hash_hex)
encoded_info_hash = urllib.parse.quote(info_hash_bytes)
announce_url = (
f"{tracker_url}?info_hash={encoded_info_hash}"
"&peer_id=-PC0001-123456789012"
"&port=6881"
"&uploaded=0"
"&downloaded=0"
"&left=0"
"&event=started"
)
http_client = AsyncHTTPClient()
try:
response = await http_client.fetch(announce_url)
decoded = bencodepy.decode(response.body)
decoded_str_keys = {k.decode('utf-8'): v for k, v in decoded.items()}
if 'extmap' in decoded_str_keys:
extmap = decoded_str_keys['extmap']
extmap_str_keys = {k.decode('utf-8'): v for k, v in extmap.items()}
print("Tracker supports the following extensions:")
for ext_name, version in extmap_str_keys.items():
print(f" {ext_name}: version {version}")
if 'hybrid' in extmap_str_keys or 'ut_hybrid' in extmap_str_keys:
print("Tracker supports hybrid torrents (BEP 34).")
return True
else:
print("Tracker does NOT explicitly support hybrid torrents.")
return False
else:
print("Tracker does not provide an extension map (no BEP 34 support).")
return False
except Exception as e:
print(f"Error contacting tracker: {e}")
return False
if __name__ == "__main__":
import asyncio
tracker = "http://tracker.example.com:6969/announce"
info_hash = "0123456789abcdef0123456789abcdef01234567"
asyncio.run(check_bep34_support(tracker, info_hash))
Metadata
Metadata
Assignees
Labels
No labels