Rat's

Simple Torrent:一个支持边下边播、无版权限制和自动上传的BT离线下载程序
说明:博主很久以前水过一个BT下载工具Cloud Torrent,不过好像2年没维护了,这里就介绍个基于Cloud...
扫描右侧二维码阅读全文
13
2020/01

Simple Torrent:一个支持边下边播、无版权限制和自动上传的BT离线下载程序

说明:博主很久以前水过一个BT下载工具Cloud Torrent,不过好像2年没维护了,这里就介绍个基于Cloud Torrent开发的项目Simple Torrent,同样的使用Golang编写,功能在原有的基础上加了些适用的功能,下载/上传速度限制、无版权限制,RSS订阅和自定义添加BT-Trackers等,而且还有api接口,同时还支持下载后自动调用外部命令,可玩性还是很高的,比如我们可以和aria2一样,将下载完成的资源自动上传到OneDriveGoogle Drive等网盘,博主大概用了下,感觉还可以,这里就分享下。

截图

请输入图片描述
请输入图片描述

安装

Github地址:https://github.com/boypt/simple-torrent

使用SSH客户端登录服务器,运行命令:

bash <(wget -qO- https://raw.githubusercontent.com/boypt/simple-torrent/master/scripts/quickinstall.sh)

然后使用ip:3000访问即可。

顺便提供个博主经常用的BT-Trackers服务器地址,效果不错,如下:

https://trackerslist.com/all.txt

直接在Web界面修改即可。

相关命令:

启动:systemctl start cloud-torrent
重启:systemctl restart cloud-torrent
停止:systemctl stop cloud-torrent
查看状态:systemctl status cloud-torrent

Docker安装

1、安装Docker

#CentOS 6系统
rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum update -y
yum -y install docker-io
service docker start
chkconfig docker on

#CentOS 7、Debian、Ubuntu系统
curl -sSL https://get.docker.com/ | sh
systemctl start docker
systemctl enable docker

2、安装Simple Torrent

docker run --restart=always --name simple-torrent -d \
-p 3000:3000 \
-v ~/downloads:/downloads \
-v ~/torrents:/torrents \
boypt/cloud-torrent

然后使用ip:3000访问即可。

最后如果你访问不了Web端,可能要检查下防火墙端口,有安全组的也要放行下相关端口。

这里提供个CentOS系统防火墙开启命令,大致如下:

#CentOS 6
iptables -I INPUT -p tcp --dport 3000 -j ACCEPT
service iptables save
service iptables restart

#CentOS 7
firewall-cmd --zone=public --add-port=3000/tcp --permanent
firewall-cmd --reload

API使用

关于API的用法,官方文档说的很详细了,这里就大概列举几个,如下:

#通过远程地址添加种子
curl --data "http://domain.com/file.torrent" "http://localhost:3000/api/url"
#通过本地文件添加种子
curl --data-binary "my.torrent" "http://localhost:3000/api/url"
#通过磁力链接添加种子
curl --data "magnet:?xt=urn:btih:..." "http://localhost:3000/api/url"

#开始种子任务
curl --data "start:${HASH}" "http://localhost:3000/api/torrent"
#停止种子任务
curl --data "stop:${HASH}" "http://localhost:3000/api/torrent"
#删除种子任务
curl --data "delete:${HASH}" "http://localhost:3000/api/torrent"

#查看文件和种子信息
/api/files和/api/torrents

外部程序调用

先修改配置文件,通过上面脚本安装的配置文件在你的主目录,比如/root目录,配置文件cloud-torrent.json

修改以下参数:

#外部程序调用参数
"donecmd": "",

#比如我要下载完成后,直接运行/home目录下的rats.sh脚本
"donecmd": "/home/rats.sh",

那么下载完成后就会运行该脚本。

一般种子下载完成后,会返回以下参数变量,这里列举下主要的:

CLD_DIR为下载路径,且为绝对路径
CLD_PATH为下载文件名称
CLD_SIZE为文件大小
CLD_TYPE为调用事件类型,分为files和torrent,分别为种子里单个文件和整体文件
CLD_HASH为文件HASH值

这里随便放一个下载后自动移动的脚本,针对rclone挂载的文件夹。

#!/bin/bash

#下载后移动的文件夹路径
RemoteDIR="/down/moerats";  

if [[ ${CLD_TYPE} == "torrent" ]]; then
eval mv \'"${CLD_DIR}/${CLD_PATH}"\' "${RemoteDIR}";
#移动后停止该任务
curl --data "stop:${CLD_HASH}" "http://127.0.0.1:3000/api/torrent";
#停止后清除该任务,也就是不会出现在Web界面了
curl --data "delete:${CLD_HASH}" "http://127.0.0.1:3000/api/torrent";
fi

这里还可以结合TG机器人啥的一起使用,玩法很多,可以自行结合API一起使用。

要注意的是,配置调用脚本的时候,需要给予脚本可执行权,并重启程序生效,比如:

#给予可执行权,脚本路径/root/rats.sh
chmod +x /root/rats.sh
#重启程序
systemctl restart cloud-torrent

相关教程

最后关于这个无版权限制,博主从未遇见过版权投诉,所以无法测试,对于下载的话,有些资源速度还是不错的,具体效果就自行体验了。

Vultr新用户注册送100美元/16个机房按小时计费,支持支付宝,【点击查看】。
最后修改:2020 年 01 月 13 日 10 : 17 PM

发表评论

83 条评论

  1. 九凌网络

    感谢分享,确实挺好用的

  2. 2

    4443

  3. chan

    这个不错,室友用了都说好,希望不会受到投诉,两个混淆开关已打开

    1. 啊飒飒
      @chan

      混淆在哪打开?

      1. Rat's
        @啊飒飒

        右上角设置那里打开

    2. Rat's
      @chan

      会不会投诉还是得看运气

  4. 你好

    评论如何设置为你这样的模式可以匿名评论发帖

    1. Rat's
      @你好

      主题自带的

  5. 你好
    该评论仅登录用户及评论双方可见
  6. ring

    1

  7. hotserv

    博主,有没有linux下好用的bt server系统,主要是用来上传,非下载

    1. Rat's
      @hotserv

      我没咋研究了,你看看这个文章https://www.moerats.com/archives/1015/,基本上就这些了

    2. Rat's
      @hotserv

      我没咋研究了,你看看这个文章https://www.moerats.com/archives/1015/,基本上就这些了

  8. 无聊死了

    你好问下我的服务器已经安装了aria2的一键脚本里面包含rlone 然后如何让这个的rlone也帮忙上传去gd

    1. Rat's
      @无聊死了

      用这个工具下载传到gd?直接可以套用下下面那个上传脚本就行,路径填到那个脚本指定的挂载目录,/home/wwwroot/a.xx.com/Cloud

      1. 无聊死了
        @Rat's

        aria2的我其实还在用可是我有些东西不能在aria2下载就只能在simple torrent下载

    2. 无聊死了
      @无聊死了

      脚本是https://www.moerats.com/archives/517/ 的

  9. Kiruba

    Thank you pretty much for sharing the massive information to us.It is very useful and informative.
    Please keep blogging new updates.

  10. coinsinic

    大佬。想问一下用脚本安装的怎么卸载?系统是centos7

    1. Rat's
      @coinsinic

      试试这个命令rm -rf /usr/local/bin/cloud-torrent ~/cloud-torrent.json