Error connecting to BitTorrent tracker: Requested download is not authorized for use with this tracker

86 Views Asked by At

I am working on a BitTorrent client in Python using the asyncio and aiohttp libraries.

I've a Tracker class which handles the communication with the tracker and a TrackerResponse class which upon successful connection, processes the tracker response, extracting the essential information such as the interval, number of seeders, and leechers, etc.

I'm using the following method in the Tracker class to make an annouce call to the tracker:

async def connect(self, first: bool = None, uploaded: int = 0, downloaded: int = 0):
        params = {
            'info_hash': self.torrent.info_hash,
            'peer_id': self.peer_id,
            'port': 6889,
            'uploaded': uploaded,
            'downloaded': downloaded,
            'left': self.torrent.total_size - downloaded,
            'compact': 1}
        if first:
            params['event'] = 'started'

        url = self.torrent.announce + '?' + urlencode(params)
        logging.info('Connecting to tracker at: ' + url)

        async with self.http_client.get(url) as response:
            if not response.status == 200:
                raise ConnectionError('Unable to connect to tracker: status code {}'.format(response.status))
            data = await response.read()
            self.raise_for_error(data)
            return TrackerResponse(bencoding.Decoder(data).decode())

Whenever, I try to download a torrent file, I get the following error:

ConnectionError: Unable to connect to tracker: d14:failure reason63:Requested download is not authorized for use with this tracker.e

This is despite the HTTP status code being 200.

I'm trying to identify the source of this error. Could there be specific tracker-related issues or configurations that might be causing this error? Are there additional steps or considerations when handling trackers that might impose authorization restrictions?

I'll really appreciate your help if any.

1

There are 1 best solutions below

0
the8472 On

Usually this error means the tracker is not an open tracker, i.e. it only accepts a set of whitelisted infohashes and yours isn't among them.

If the tracker has an associated indexing site you can check there which torrents they currently offer.

If the tracker comes from the torrent's metadata then it's perhaps outdated and you'll have to look for a newer version of the torrent.