python - 建立一个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'
我想知道是否有人可以告诉我我的请求有什么问题?非常感谢!
解决方案
看看这个答案,很多人已经问过了 https://stackoverflow.com/a/1019588/4399634
或者你可以使用这个 bit-torrent 客户端,它非常简单实用 https://github.com/borzunov/bit-torrent
推荐阅读
- python - 将numpy数组值设置为一个常量值,除了边缘上的元素
- actionscript-3 - 如何使对象在特定位置移动 flash as3
- reactjs - 如何模拟具有 fetch 调用的函数调用
- azure-active-directory - 无法使用所有者服务原则在管道中创建角色分配
- c# - URL 在 Android 9 的 Unity 游戏中不起作用
- python - Django 自定义标签过滤
- php - 如何从 PHP 邮件功能获取投递报告?
- vb.net - VB.net 在预定日期执行任务
- c# - 如何使用 .NET Core API 调用从 .NET Core 控制台应用程序创建的 dll
- r - 库没有被调用