chenjiandongx / magnet-dht

✌️ Python3 BitTorrent DHT crawler
MIT License
958 stars 286 forks source link

use aria2 jsonrpc #1

Closed eternal-flame-AD closed 6 years ago

eternal-flame-AD commented 6 years ago

Tried it last night and it was cool~

I think it would be better if we use aria2c jsonrpc to provide more flexibility to the program.

chenjiandongx commented 6 years ago

@eternal-flame-AD 效率如何

eternal-flame-AD commented 6 years ago

aria2c服务端会并行,我这里效率差不多。

chenjiandongx commented 6 years ago

试了你的代码,一启动就挂了....

eternal-flame-AD commented 6 years ago

aria那边cli有显示接收到了任务吗?

eternal-flame-AD commented 6 years ago

这是我测试的

===============================================================
$python3
>>> import magnet_dht.magnet_to_torrent_aria2c
>>> magnet_dht.magnet_to_torrent_aria2c.exec_rpc("magnet:?xt=urn:btih:a782527887a545f110e43ee04616a5d2b02ff02b&dn=archlinux-2018.07.01-x86_64.iso&tr=udp://tracker.archlinux.org:6969&tr=http://tracker.archlinux.org:6969/announce")

====================================================

$aria2c --enable-rpc

07/07 16:56:57 [WARN] Neither --rpc-secret nor a combination of --rpc-user and --rpc-passwd is set. This is insecure. It is extremely recommended to specify --rpc-secret with the adequate secrecy or now deprecated --rpc-user and --rpc-passwd.

07/07 16:56:57 [NOTICE] IPv4 RPC: listening on TCP port 6800

07/07 16:59:25 [NOTICE] IPv4 DHT: listening on UDP port 6885

07/07 16:59:25 [NOTICE] IPv4 BitTorrent: listening on TCP port 6965
 *** Download Progress Summary as of Sat Jul 07 16:59:25 2018 ***
======================================================================================================================
[#32c6a2 0B/0B CN:0 SD:0 DL:0B]
FILE: [MEMORY][METADATA]archlinux-2018.07.01-x86_64.iso
----------------------------------------------------------------------------------------------------------------------

[#32c6a2 22KiB/22KiB(100%) CN:14 SD:2]
07/07 16:59:31 [NOTICE] Download complete: [MEMORY][METADATA]archlinux-2018.07.01-x86_64.iso

07/07 16:59:31 [NOTICE] Allocating disk space. Use --file-allocation=none to disable it. See --file-allocation option in man page for more details.
eternal-flame-AD commented 6 years ago

你的aria2c版本是啥,启动的时候用了哪些配置……我按你的环境试试

chenjiandongx commented 6 years ago

研究了一番 aria2c 的 PRC 部分的文档,现在 ok 了,我测试一下效率。

chenjiandongx commented 6 years ago

@eternal-flame-AD 我发现你对我的项目好像都比较感兴趣哈

eternal-flame-AD commented 6 years ago

哈哈哈,比较符合兴趣?23333 对了还有个问题……bt-metadata-only开关我发现有的时候不起作用(aria2c文档里说可以但实测不是很稳定……),aria2会下载整个文件,要写在conffile里,如果有幸merge了可能要在README里写一下~

chenjiandongx commented 6 years ago

@eternal-flame-AD

ef@eternalflame.cn 是你的私人邮箱吗

eternal-flame-AD commented 6 years ago

chenjiandongx commented 6 years ago

那检查一下收件箱

vvvbeauty commented 3 years ago

y