连接 BitTorrent 跟踪器时出错:请求的下载未获授权与此跟踪器一起使用

问题描述 投票:0回答:1

我正在使用 asyncio 和 aiohttp 库使用 Python 开发 BitTorrent 客户端。

我有一个

Tracker
类,用于处理与跟踪器的通信,还有一个
TrackerResponse
类,在成功连接后,处理跟踪器响应,提取基本信息,例如间隔、播种者数量和水蛭数量等。

我在

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())

每当我尝试下载 torrent 文件时,都会收到以下错误:

连接错误:无法连接到跟踪器:d14:失败原因63:请求的下载未获授权与此跟踪器一起使用。e

尽管 HTTP 状态代码为 200,但仍然如此。

我正在尝试确定此错误的根源。是否存在可能导致此错误的特定跟踪器相关问题或配置?处理可能施加授权限制的跟踪器时是否有其他步骤或注意事项?

如果有的话,我将非常感谢您的帮助。

python http python-asyncio aiohttp bittorrent
1个回答
0
投票

通常此错误意味着跟踪器不是开放跟踪器,即它只接受一组白名单信息哈希,而您的信息哈希不在其中。

如果跟踪器有关联的索引站点,您可以在那里检查他们当前提供的种子。

如果跟踪器来自 torrent 的元数据,那么它可能已经过时,您将不得不寻找更新版本的 torrent。

© www.soinside.com 2019 - 2024. All rights reserved.