【问题标题】:Building a bittorrent client? Getting information from Tracker?建立一个bittorrent客户端?从 Tracker 获取信息?
【发布时间】:2018-08-02 15:42:04
【问题描述】:

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

我正在尝试从跟踪器获取 the torrent file to download ubuntu 的对等信息。

我已经对 .torrent 文件进行了 B 解码并提取了信息字典并从中创建了一个 SHA1 哈希(完全按照 bittorrent protocol 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'

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

【问题讨论】:

  • 不是答案,但您可能想看看这个:markuseliasson.se/article/bittorrent-in-python
  • 感谢您的链接!我已经看到了,并且我的代码也以此为基础!我尝试从该帖子中散列 B 编码的信息字典,并且我的 URL 与那个匹配。这就是为什么我对为什么我的代码似乎不起作用感到困惑的部分原因。谢谢!
  • 问题是该种子未在跟踪器上列入白名单。它可能已被删除,因为它太旧了。尝试更新的 Ubuntu 种子。

标签: python http python-requests bittorrent


【解决方案1】:

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

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

【讨论】:

  • 您好,感谢您的回答!我已经尝试了您与 requests.get('torrent.ubuntu.com:6969/…) 链接的答案,但我遇到了同样的错误...请求的下载未被授权用于此跟踪器。我还尝试用我创建的随机 peerID 替换其中的 peerID,但我仍然遇到同样的错误。
  • 顺便说一句,我已经尝试过您链接的 bit-torrent 客户端,我得到了同样的错误。我也查看了该客户端上的源代码以提取它正在使用的 HTTP 链接,如果我尝试 GET ,我会得到相同的 d14 失败。
猜你喜欢
  • 2014-10-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-02-21
  • 2018-12-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多