首页 > 解决方案 > 建立一个bittorrent客户端?从 Tracker 获取信息?

问题描述

我目前正在使用 Python 开发一个 bittorrent 客户端。

我正在尝试从 Tracker 获取 Peer Information以下载 torrent 文件以下载 ubuntu

我已经对 .torrent 文件进行了 B 解码并提取了信息字典并从中创建了一个 SHA1 哈希(完全按照bittorrent 协议 wiki中的指定)。

我正在使用 python 的 requests 库发送 HTTP Get 请求,但是当我发送请求时,我得到了一个错误。

这是我使用 .torrent 文件中指定的 tracker_url 对 Ubuntu 种子的 Python GET 请求

resp = requests.get('http://torrent.ubuntu.com:6969/announce?info_hash=%3F%19%B1I%F5%3AP%E1O%C0%B7%99%26%A3%91%89n%AB%ABo&peer_id=SAoe4hc3u3du0nepwp1h&compact=1&no_peer_id=0&event=started&port=6883&uploaded=0&downloaded=0&left=1178386432')

作为回应,我得到一个 Response 200,而 resp.content 是

b'd14:failure reason63:Requested download is not authorized for use with this tracker.e'

我想知道是否有人可以告诉我我的请求有什么问题?非常感谢!

标签: pythonhttppython-requestsbittorrent

解决方案


看看这个答案,很多人已经问过了 https://stackoverflow.com/a/1019588/4399634

或者你可以使用这个 bit-torrent 客户端,它非常简单实用 https://github.com/borzunov/bit-torrent


推荐阅读