mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-08-24 15:04:50 +00:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
29c2e43405 | ||
|
18cdd7abed | ||
|
4fbf795811 | ||
|
88ebc12ce5 | ||
|
08b4b58083 | ||
|
ca02231431 | ||
|
7d638eba40 | ||
|
c35c23583c | ||
|
b2b9000a86 | ||
|
b80a5b89cc | ||
|
c2e5b4d00b | ||
|
207320ede7 | ||
|
6e1653fc1e |
@@ -13,7 +13,7 @@ use IYUU\Library\Table;
|
||||
class AutoReseed
|
||||
{
|
||||
// 版本号
|
||||
const VER = '1.9.3';
|
||||
const VER = '1.9.8';
|
||||
// RPC连接
|
||||
private static $links = [];
|
||||
// 客户端配置
|
||||
@@ -22,8 +22,6 @@ class AutoReseed
|
||||
private static $sites = [];
|
||||
// 不辅种的站点 'pt','hdchina'
|
||||
private static $noReseed = [];
|
||||
// 不转移的站点 'hdarea','hdbd'
|
||||
private static $noMove = [];
|
||||
// cookie检查
|
||||
private static $cookieCheck = ['hdchina','hdcity'];
|
||||
// 缓存路径
|
||||
@@ -37,7 +35,6 @@ class AutoReseed
|
||||
'sites' => '/api/sites',
|
||||
'infohash'=> '/api/infohash',
|
||||
'notify' => '/api/notify',
|
||||
'alike' => '/api/alike',
|
||||
'hash' => '/api/hash',
|
||||
);
|
||||
// curl
|
||||
@@ -56,6 +53,8 @@ class AutoReseed
|
||||
'reseedRepeat' => 0, // 重复:客户端已做种
|
||||
'reseedSkip' => 0, // 跳过:因未设置passkey,而跳过
|
||||
'reseedPass' => 0, // 忽略:因上次成功添加、存在缓存,而跳过
|
||||
'MoveSuccess' => 0, // 移动成功
|
||||
'MoveError' => 0, // 移动失败
|
||||
);
|
||||
// 错误通知消息体
|
||||
private static $errNotify = array(
|
||||
@@ -76,12 +75,15 @@ class AutoReseed
|
||||
self::$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
|
||||
self::$curl->setOpt(CURLOPT_SSL_VERIFYHOST, 2);
|
||||
|
||||
// 合作站点自动鉴权绑定
|
||||
// 合作站点鉴权绑定
|
||||
Oauth::login(self::$apiUrl . self::$endpoints['login']);
|
||||
|
||||
// 显示支持站点列表
|
||||
self::ShowTableSites();
|
||||
self::$clients = isset($configALL['default']['clients']) && $configALL['default']['clients'] ? $configALL['default']['clients'] : array();
|
||||
if (empty(self::$clients)){
|
||||
die('全局客户端为空!');
|
||||
}
|
||||
|
||||
// 递归删除上次历史记录
|
||||
IFile::rmdir(self::$cacheDir, true);
|
||||
@@ -125,9 +127,6 @@ class AutoReseed
|
||||
if (isset($rs['msg']) && $rs['msg']) {
|
||||
die($rs['msg'].PHP_EOL);
|
||||
}
|
||||
if (isset($rs['errmsg']) && $rs['errmsg']) {
|
||||
die($rs['errmsg'].PHP_EOL);
|
||||
}
|
||||
die('远端服务器无响应,请稍后再试!!!');
|
||||
}
|
||||
$data = [];
|
||||
@@ -218,8 +217,6 @@ class AutoReseed
|
||||
$errmsg = isset($result['result']) ? $result['result'] : '未知错误,请稍后重试!';
|
||||
if (strpos($errmsg, 'http error 404: Not Found') !== false) {
|
||||
self::sendNotify('404');
|
||||
} elseif (strpos($errmsg, 'http error 403: Forbidden') !== false) {
|
||||
self::sendNotify('403');
|
||||
}
|
||||
print "-----RPC添加种子任务,失败 [{$errmsg}]" . PHP_EOL.PHP_EOL;
|
||||
}
|
||||
@@ -269,6 +266,7 @@ class AutoReseed
|
||||
}
|
||||
self::reseed();
|
||||
self::wechatMessage();
|
||||
exit(self::$ExitCode);
|
||||
}
|
||||
/**
|
||||
* IYUUAutoReseed辅种
|
||||
@@ -446,23 +444,12 @@ class AutoReseed
|
||||
case 'hdchina':
|
||||
$cookie = $configALL[$siteName]['cookie'];
|
||||
$userAgent = $configALL['default']['userAgent'];
|
||||
// 拼接URL
|
||||
// 拼接详情页URL
|
||||
$details_page = str_replace('{}', $value['torrent_id'], 'details.php?id={}&hit=1');
|
||||
$details_url = $protocol .$sites[$sid]['base_url']. '/' .$details_page;
|
||||
print "种子详情页:".$details_url.PHP_EOL;
|
||||
$details_html = download($details_url, $cookie, $userAgent);
|
||||
if (empty($details_html)) {
|
||||
ff($siteName. '站点,cookie已过期,请更新后重新辅种!');
|
||||
echo 'cookie已过期,请更新后重新辅种!已加入排除列表'.PHP_EOL;
|
||||
$t = 30;
|
||||
do {
|
||||
echo microtime(true)." cookie已过期,请更新后重新辅种!已加入排除列表!,{$t}秒后继续...".PHP_EOL;
|
||||
sleep(1);
|
||||
} while (--$t > 0);
|
||||
$configALL[$siteName]['cookie'] = '';
|
||||
$reseedPass = true;
|
||||
break;
|
||||
}
|
||||
// 删种检查
|
||||
if (strpos($details_html, '没有该ID的种子') != false) {
|
||||
echo '种子已被删除!'.PHP_EOL;
|
||||
self::sendNotify('404');
|
||||
@@ -473,23 +460,23 @@ class AutoReseed
|
||||
$offset = strpos($details_html, str_replace('{hash}', '', $sites[$sid]['download_page']));
|
||||
if ($offset === false) {
|
||||
ff($siteName. '站点,cookie已过期,请更新后重新辅种!');
|
||||
echo 'cookie已过期,请更新后重新辅种!'.PHP_EOL;
|
||||
echo 'cookie已过期,请更新后重新辅种!已加入排除列表'.PHP_EOL;
|
||||
$t = 15;
|
||||
do {
|
||||
echo microtime(true)." cookie已过期,请更新后重新辅种!已加入排除列表!,{$t}秒后继续...".PHP_EOL;
|
||||
sleep(1);
|
||||
} while (--$t > 0);
|
||||
$configALL[$siteName]['cookie'] = '';
|
||||
$reseedPass = true;
|
||||
break;
|
||||
}
|
||||
$urlTemp = substr($details_html, $offset, 50);
|
||||
// 种子地址
|
||||
$download_page = substr($urlTemp, 0, strpos($urlTemp, '">'));
|
||||
if (empty($download_page)) {
|
||||
echo '未知错误,未提取到种子URL,请联系脚本作者!'.PHP_EOL;
|
||||
$reseedPass = true;
|
||||
break;
|
||||
}
|
||||
$regex = "/download.php\?hash\=(.*?)[\"|\']/i"; // 提取种子hash的正则表达式
|
||||
preg_match($regex, $details_html, $matchs);
|
||||
$download_page = str_replace('{hash}', $matchs[1], $sites[$sid]['download_page']);
|
||||
$_url = $protocol . $sites[$sid]['base_url']. '/' . $download_page;
|
||||
print "种子下载页:".$_url.PHP_EOL;
|
||||
$url = download($_url, $cookie, $userAgent);
|
||||
#p($url);
|
||||
if (strpos($url, '第一次下载提示') != false) {
|
||||
echo "当前站点触发第一次下载提示,已加入排除列表".PHP_EOL;
|
||||
echo "请进入瓷器详情页,点右上角蓝色框:下载种子,成功后更新cookie!".PHP_EOL;
|
||||
@@ -529,9 +516,9 @@ class AutoReseed
|
||||
$reseedPass = true;
|
||||
break;
|
||||
}
|
||||
$len = strlen('cuhash=');
|
||||
$cuhashTemp = substr($html, $offset+$len, 40);
|
||||
$configALL[$siteName]['cuhash'] = substr($cuhashTemp, 0, strpos($cuhashTemp, '"'));
|
||||
$regex = "/cuhash\=(.*?)[\"|\']/i"; // 提取种子cuhash的正则表达式
|
||||
preg_match($regex, $html, $matchs);
|
||||
$configALL[$siteName]['cuhash'] = $matchs[1];
|
||||
}
|
||||
$url = str_replace('{cuhash}', $configALL[$siteName]['cuhash'], $_url);
|
||||
// 城市下载种子时会302转向
|
||||
@@ -609,6 +596,10 @@ class AutoReseed
|
||||
echo "clients_".$k."是目标转移客户端,避免冲突,已跳过!".PHP_EOL.PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
if (empty(self::$links[$k])) {
|
||||
echo "clients_".$k." 用户名或密码未配置,已跳过".PHP_EOL.PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
echo "正在从下载器 clients_".$k." 获取种子哈希……".PHP_EOL;
|
||||
$move = []; // 客户端做种列表 传址
|
||||
$hashArray = self::$links[$k]['rpc']->getList($move);
|
||||
@@ -704,9 +695,11 @@ class AutoReseed
|
||||
// 转移成功的种子,以infohash为文件名,写入缓存
|
||||
wlog($log, $info_hash, self::$cacheMove);
|
||||
wlog($log, 'MoveSuccess'.$k);
|
||||
self::$wechatMsg['MoveSuccess']++;
|
||||
} else {
|
||||
// 失败的种子
|
||||
wlog($log, 'MoveError'.$k);
|
||||
self::$wechatMsg['MoveError']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -864,13 +857,25 @@ class AutoReseed
|
||||
$desp .= '**支持站点:'.self::$wechatMsg['sitesCount']. '** [当前支持自动辅种的站点数量]' .$br;
|
||||
$desp .= '**总做种:'.self::$wechatMsg['hashCount'] . '** [客户端做种的hash总数]' .$br;
|
||||
$desp .= '**返回数据:'.self::$wechatMsg['reseedCount']. '** [服务器返回的可辅种数据]' .$br;
|
||||
$desp .= '**成功:'.self::$wechatMsg['reseedSuccess']. '** [辅种成功,会把hash加入缓存]' .$br;
|
||||
$desp .= '**成功:'.self::$wechatMsg['reseedSuccess']. '** [会把hash加入辅种缓存]' .$br;
|
||||
$desp .= '**失败:'.self::$wechatMsg['reseedError']. '** [种子下载失败或网络超时引起]' .$br;
|
||||
$desp .= '**重复:'.self::$wechatMsg['reseedRepeat']. '** [客户端已做种]' .$br;
|
||||
$desp .= '**跳过:'.self::$wechatMsg['reseedSkip']. '** [未设置passkey]' .$br;
|
||||
$desp .= '**忽略:'.self::$wechatMsg['reseedPass']. '** [成功添加存在缓存]' .$br;
|
||||
$desp .= $br.'**如需重新辅种,请删除 ./torrent/cachehash 内的所有辅种缓存。**'.$br;
|
||||
$desp .= '*此消息将在3天后过期*。';
|
||||
// 失败详情
|
||||
if (self::$wechatMsg['reseedError']) {
|
||||
$desp .= '**失败详情,见 ./torrent/cache/reseedError.txt**'.$br;
|
||||
}
|
||||
// 重新辅种
|
||||
$desp .= '**如需重新辅种,请删除 ./torrent/cachehash 辅种缓存。**'.$br;
|
||||
// 移动做种
|
||||
if (self::$wechatMsg['MoveSuccess'] || self::$wechatMsg['MoveError']) {
|
||||
$desp .= $br.'----------'.$br;
|
||||
$desp .= '**移动成功:'.self::$wechatMsg['MoveSuccess']. '** [会把hash加入移动缓存]' .$br;
|
||||
$desp .= '**移动失败:'.self::$wechatMsg['MoveError']. '** [解决错误提示,可以重试]' .$br;
|
||||
$desp .= '**如需重新移动,请删除 ./torrent/cachemove 移动缓存。**'.$br;
|
||||
}
|
||||
$desp .= $br.'*此消息将在3天后过期*。';
|
||||
return ff($text, $desp);
|
||||
}
|
||||
/**
|
||||
|
@@ -30,8 +30,8 @@ return array(
|
||||
array(
|
||||
'type' => 'transmission', // 支持:transmission、qBittorrent
|
||||
'host' => 'http://127.0.0.1:9091/transmission/rpc', // 警告!注意:transmission/rpc这段别动,你只需要修改 127.0.0.1:9091
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
'username' => 'null',
|
||||
'password' => 'null',
|
||||
'BT_backup' => '/var/lib/transmission/torrents', // 移动做种:如果脚本与当前客户端不在一台机器,必须配置
|
||||
'move' => 0, // 0不移动,1移动并辅种,2移动且只在当前客户端辅种
|
||||
),
|
||||
@@ -40,7 +40,7 @@ return array(
|
||||
array(
|
||||
'type' => 'qBittorrent', // 支持:transmission、qBittorrent
|
||||
'host' => 'http://127.0.0.1:8083',
|
||||
'username' => '',
|
||||
'username' => 'admin',
|
||||
'password' => '',
|
||||
'root_folder'=> 1, // 0不创建根目录,1创建根目录
|
||||
'BT_backup' => 'C:\Users\ASUS\AppData\Local\qBittorrent\BT_backup', // 移动做种:必须配置,Linux搜索方法:find / -name BT_backup
|
||||
@@ -103,6 +103,15 @@ return array(
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
'id' => 0, // 用户ID(不是用户名)
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(
|
||||
//'ipv6=1', // 种子Tracker的IP地址选择 可选:ipv4,ipv6
|
||||
//'https=1',
|
||||
),
|
||||
'limitRule' => array(
|
||||
'count' => 20, // 每次辅种20个
|
||||
'sleep' => 15, // 最少休眠15秒
|
||||
),
|
||||
'workingMode' => 0,
|
||||
'watch' => '/root/downloads',
|
||||
'filter' => array(
|
||||
@@ -111,11 +120,7 @@ return array(
|
||||
'max' => '280GB',
|
||||
),
|
||||
),
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(
|
||||
//'ipv6=1', // 种子Tracker的IP地址选择 可选:ipv4,ipv6
|
||||
//'https=1',
|
||||
),
|
||||
|
||||
),
|
||||
// hddolby
|
||||
'hddolby' => array(
|
||||
@@ -126,6 +131,10 @@ return array(
|
||||
'id' => 0, // 用户ID(不是用户名)
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
'limitRule' => array(
|
||||
'count' => 20, // 每次辅种20个
|
||||
'sleep' => 5, // 最少休眠5秒
|
||||
),
|
||||
),
|
||||
// hdhome
|
||||
'hdhome' => array(
|
||||
@@ -136,6 +145,10 @@ return array(
|
||||
'id' => 0, // 用户ID(不是用户名)
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
'limitRule' => array(
|
||||
'count' => 20, // 每次辅种20个
|
||||
'sleep' => 5, // 最少休眠5秒
|
||||
),
|
||||
),
|
||||
// PTHome
|
||||
'pthome' => array(
|
||||
@@ -146,6 +159,10 @@ return array(
|
||||
'id' => 0, // 用户ID(不是用户名)
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
'limitRule' => array(
|
||||
'count' => 20, // 每次辅种20个
|
||||
'sleep' => 5, // 最少休眠5秒
|
||||
),
|
||||
),
|
||||
// MoeCat
|
||||
'moecat' => array(
|
||||
@@ -157,7 +174,11 @@ return array(
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(
|
||||
//'ipv6=1', // 种子Tracker的IP地址选择 可选:ipv4,ipv6
|
||||
//'https=1',
|
||||
'https=1',
|
||||
),
|
||||
'limitRule' => array(
|
||||
'count' => 20, // 每次辅种20个
|
||||
'sleep' => 15, // 最少休眠15秒
|
||||
),
|
||||
),
|
||||
// m-team
|
||||
@@ -292,6 +313,10 @@ return array(
|
||||
'passkey' => '',
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
'limitRule' => array(
|
||||
'count' => 20, // 每次辅种20个
|
||||
'sleep' => 15, // 最少休眠15秒
|
||||
),
|
||||
),
|
||||
// yingk
|
||||
'yingk' => array(
|
||||
@@ -391,6 +416,10 @@ return array(
|
||||
'passkey' => '',
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
'limitRule' => array(
|
||||
'count' => 10, // 每次辅种10个
|
||||
'sleep' => 5, // 最少休眠15秒
|
||||
),
|
||||
),
|
||||
// hdarea
|
||||
'hdarea' => array(
|
||||
@@ -592,6 +621,10 @@ return array(
|
||||
'passkey' => '',
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
'limitRule' => array(
|
||||
'count' => 20, // 每次辅种20个
|
||||
'sleep' => 20, // 最少休眠20秒
|
||||
),
|
||||
),
|
||||
// hdroute
|
||||
'hdroute' => array(
|
||||
|
6
init.php
6
init.php
@@ -53,12 +53,14 @@ if (file_exists(ROOT_PATH."/config/config.php")) {
|
||||
// 示例配置
|
||||
$configALL = require_once ROOT_PATH . '/config/config.sample.php';
|
||||
echo microtime(true).' 缺少config.php,已载入config.sample.php示例配置。'.PHP_EOL;
|
||||
echo microtime(true).' 请把配置文件改名为config.php,以免后续版本升级覆盖配置!!!'.PHP_EOL;
|
||||
echo microtime(true).' 请编辑配置文件config.php,以免后续版本升级覆盖配置!!!'.PHP_EOL;
|
||||
$t = 30;
|
||||
do {
|
||||
echo microtime(true)." 请把配置文件改名为config.php,{$t}秒后继续...".PHP_EOL;
|
||||
echo microtime(true)." 请编辑配置文件config.php,{$t}秒后继续...".PHP_EOL;
|
||||
sleep(1);
|
||||
} while (--$t > 0);
|
||||
// 第一次会生成
|
||||
@copy(ROOT_PATH . '/config/config.sample.php', ROOT_PATH . '/config/config.php');
|
||||
}
|
||||
echo microtime(true).' 全局配置载入完成!'.PHP_EOL;
|
||||
// 读取支持列表
|
||||
|
1
iyuu.php
1
iyuu.php
@@ -29,4 +29,3 @@ use IYUU\AutoReseed;
|
||||
|
||||
AutoReseed::init();
|
||||
AutoReseed::call();
|
||||
exit(0);
|
||||
|
@@ -10,6 +10,8 @@
|
||||
|
||||
第三:您使用IYUU工具造成的一切损失,与IYUU无关。如不接受此条款,请不要使用IYUUAutoReseed,并立刻删除已经下载的源码。
|
||||
|
||||

|
||||
|
||||
## 获取脚本,三种方式皆可
|
||||
|
||||
1. 通过git命令安装
|
||||
@@ -73,8 +75,12 @@ IYUU自动辅种工具(英文名:IYUUAutoReseed),是一款PHP语言编
|
||||
|
||||
实时更新的接口文档:http://api.iyuu.cn/docs.php
|
||||
|
||||
## 相关项目
|
||||
|
||||
#todo...
|
||||
|
||||
## 需求提交/错误反馈
|
||||
|
||||
- QQ群:859882209[2000人.入门群],931954050[1000人.进阶群]
|
||||
- 问答社区:http://wenda.iyuu.cn
|
||||
- 博客:https://www.iyuu.cn/
|
||||
|
@@ -1,5 +1,5 @@
|
||||
## 支持用户验证的合作站点:`ourbits`,`hddolby`,`hdhome`,`pthome`
|
||||
截止2020年3月15日13:25:30【文档更新有延迟,最终以gitee、github为准】
|
||||
## 支持用户验证的合作站点:`ourbits`,`hddolby`,`hdhome`,`pthome`,`moecat`
|
||||
截止2020年7月17日20:30:53【文档更新有延迟,最终以gitee、github为准】
|
||||
|
||||
|
||||
----------
|
||||
|
@@ -85,9 +85,11 @@
|
||||
|
||||
#### 问:如何反馈问题?
|
||||
|
||||
答:1、点击链接加入群聊【IYUU自动辅种交流】:[https://jq.qq.com/?_wv=1027&k=5JOfOlM][1]
|
||||
答:1、QQ群:859882209[2000人.入门群],931954050[1000人.进阶群]
|
||||
|
||||
2、QQ群:859882209
|
||||
2、问答社区:http://wenda.iyuu.cn
|
||||
|
||||
3、issues: https://gitee.com/ledc/IYUUAutoReseed/issues
|
||||
3、博客:https://www.iyuu.cn
|
||||
|
||||
4、issues: https://gitee.com/ledc/IYUUAutoReseed/issues
|
||||
|
||||
|
@@ -13,8 +13,7 @@
|
||||
| Google身份验证器(谷歌动态口令) | 开发中 | 2020年2月21日 | |
|
||||
| 自动更新 | 开发中 | 2020年2月21日 | |
|
||||
| WEB页面生成配置 | 开发中 | 2020年2月21日 | |
|
||||
| 种子删除自动同步 | 开发中 | 2020年2月21日 | 2020年5月6日 |
|
||||
| 种子删除自动同步 | 已完成 | 2020年2月21日 | 2020年5月6日 |
|
||||
| 脚本docker容器化(测试版) | 已完成 | 2020年2月21日 | 2020年2月21日 |
|
||||
| 自动配置(简化配置) | 开发中 | 2020年4月10日 | |
|
||||
| 浏览器插件 | 暂未开始 | | |
|
||||
| 合集自动拆包辅种 | 暂未开始 | | |
|
||||
|
Reference in New Issue
Block a user