mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-05-23 10:05:23 +00:00
首次运行生成config.php;提高瓷器、城市兼容性。
This commit is contained in:
parent
18cdd7abed
commit
29c2e43405
@ -13,7 +13,7 @@ use IYUU\Library\Table;
|
|||||||
class AutoReseed
|
class AutoReseed
|
||||||
{
|
{
|
||||||
// 版本号
|
// 版本号
|
||||||
const VER = '1.9.7';
|
const VER = '1.9.8';
|
||||||
// RPC连接
|
// RPC连接
|
||||||
private static $links = [];
|
private static $links = [];
|
||||||
// 客户端配置
|
// 客户端配置
|
||||||
@ -444,23 +444,12 @@ class AutoReseed
|
|||||||
case 'hdchina':
|
case 'hdchina':
|
||||||
$cookie = $configALL[$siteName]['cookie'];
|
$cookie = $configALL[$siteName]['cookie'];
|
||||||
$userAgent = $configALL['default']['userAgent'];
|
$userAgent = $configALL['default']['userAgent'];
|
||||||
// 拼接URL
|
// 拼接详情页URL
|
||||||
$details_page = str_replace('{}', $value['torrent_id'], 'details.php?id={}&hit=1');
|
$details_page = str_replace('{}', $value['torrent_id'], 'details.php?id={}&hit=1');
|
||||||
$details_url = $protocol .$sites[$sid]['base_url']. '/' .$details_page;
|
$details_url = $protocol .$sites[$sid]['base_url']. '/' .$details_page;
|
||||||
print "种子详情页:".$details_url.PHP_EOL;
|
print "种子详情页:".$details_url.PHP_EOL;
|
||||||
$details_html = download($details_url, $cookie, $userAgent);
|
$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) {
|
if (strpos($details_html, '没有该ID的种子') != false) {
|
||||||
echo '种子已被删除!'.PHP_EOL;
|
echo '种子已被删除!'.PHP_EOL;
|
||||||
self::sendNotify('404');
|
self::sendNotify('404');
|
||||||
@ -471,23 +460,23 @@ class AutoReseed
|
|||||||
$offset = strpos($details_html, str_replace('{hash}', '', $sites[$sid]['download_page']));
|
$offset = strpos($details_html, str_replace('{hash}', '', $sites[$sid]['download_page']));
|
||||||
if ($offset === false) {
|
if ($offset === false) {
|
||||||
ff($siteName. '站点,cookie已过期,请更新后重新辅种!');
|
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'] = '';
|
$configALL[$siteName]['cookie'] = '';
|
||||||
$reseedPass = true;
|
$reseedPass = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$urlTemp = substr($details_html, $offset, 50);
|
|
||||||
// 种子地址
|
// 种子地址
|
||||||
$download_page = substr($urlTemp, 0, strpos($urlTemp, '">'));
|
$regex = "/download.php\?hash\=(.*?)[\"|\']/i"; // 提取种子hash的正则表达式
|
||||||
if (empty($download_page)) {
|
preg_match($regex, $details_html, $matchs);
|
||||||
echo '未知错误,未提取到种子URL,请联系脚本作者!'.PHP_EOL;
|
$download_page = str_replace('{hash}', $matchs[1], $sites[$sid]['download_page']);
|
||||||
$reseedPass = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$_url = $protocol . $sites[$sid]['base_url']. '/' . $download_page;
|
$_url = $protocol . $sites[$sid]['base_url']. '/' . $download_page;
|
||||||
print "种子下载页:".$_url.PHP_EOL;
|
print "种子下载页:".$_url.PHP_EOL;
|
||||||
$url = download($_url, $cookie, $userAgent);
|
$url = download($_url, $cookie, $userAgent);
|
||||||
#p($url);
|
|
||||||
if (strpos($url, '第一次下载提示') != false) {
|
if (strpos($url, '第一次下载提示') != false) {
|
||||||
echo "当前站点触发第一次下载提示,已加入排除列表".PHP_EOL;
|
echo "当前站点触发第一次下载提示,已加入排除列表".PHP_EOL;
|
||||||
echo "请进入瓷器详情页,点右上角蓝色框:下载种子,成功后更新cookie!".PHP_EOL;
|
echo "请进入瓷器详情页,点右上角蓝色框:下载种子,成功后更新cookie!".PHP_EOL;
|
||||||
@ -527,9 +516,9 @@ class AutoReseed
|
|||||||
$reseedPass = true;
|
$reseedPass = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$len = strlen('cuhash=');
|
$regex = "/cuhash\=(.*?)[\"|\']/i"; // 提取种子cuhash的正则表达式
|
||||||
$cuhashTemp = substr($html, $offset+$len, 40);
|
preg_match($regex, $html, $matchs);
|
||||||
$configALL[$siteName]['cuhash'] = substr($cuhashTemp, 0, strpos($cuhashTemp, '"'));
|
$configALL[$siteName]['cuhash'] = $matchs[1];
|
||||||
}
|
}
|
||||||
$url = str_replace('{cuhash}', $configALL[$siteName]['cuhash'], $_url);
|
$url = str_replace('{cuhash}', $configALL[$siteName]['cuhash'], $_url);
|
||||||
// 城市下载种子时会302转向
|
// 城市下载种子时会302转向
|
||||||
|
@ -30,8 +30,8 @@ return array(
|
|||||||
array(
|
array(
|
||||||
'type' => 'transmission', // 支持:transmission、qBittorrent
|
'type' => 'transmission', // 支持:transmission、qBittorrent
|
||||||
'host' => 'http://127.0.0.1:9091/transmission/rpc', // 警告!注意:transmission/rpc这段别动,你只需要修改 127.0.0.1:9091
|
'host' => 'http://127.0.0.1:9091/transmission/rpc', // 警告!注意:transmission/rpc这段别动,你只需要修改 127.0.0.1:9091
|
||||||
'username' => '',
|
'username' => 'null',
|
||||||
'password' => '',
|
'password' => 'null',
|
||||||
'BT_backup' => '/var/lib/transmission/torrents', // 移动做种:如果脚本与当前客户端不在一台机器,必须配置
|
'BT_backup' => '/var/lib/transmission/torrents', // 移动做种:如果脚本与当前客户端不在一台机器,必须配置
|
||||||
'move' => 0, // 0不移动,1移动并辅种,2移动且只在当前客户端辅种
|
'move' => 0, // 0不移动,1移动并辅种,2移动且只在当前客户端辅种
|
||||||
),
|
),
|
||||||
@ -40,7 +40,7 @@ return array(
|
|||||||
array(
|
array(
|
||||||
'type' => 'qBittorrent', // 支持:transmission、qBittorrent
|
'type' => 'qBittorrent', // 支持:transmission、qBittorrent
|
||||||
'host' => 'http://127.0.0.1:8083',
|
'host' => 'http://127.0.0.1:8083',
|
||||||
'username' => '',
|
'username' => 'admin',
|
||||||
'password' => '',
|
'password' => '',
|
||||||
'root_folder'=> 1, // 0不创建根目录,1创建根目录
|
'root_folder'=> 1, // 0不创建根目录,1创建根目录
|
||||||
'BT_backup' => 'C:\Users\ASUS\AppData\Local\qBittorrent\BT_backup', // 移动做种:必须配置,Linux搜索方法:find / -name BT_backup
|
'BT_backup' => 'C:\Users\ASUS\AppData\Local\qBittorrent\BT_backup', // 移动做种:必须配置,Linux搜索方法:find / -name BT_backup
|
||||||
|
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';
|
$configALL = require_once ROOT_PATH . '/config/config.sample.php';
|
||||||
echo microtime(true).' 缺少config.php,已载入config.sample.php示例配置。'.PHP_EOL;
|
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;
|
$t = 30;
|
||||||
do {
|
do {
|
||||||
echo microtime(true)." 请把配置文件改名为config.php,{$t}秒后继续...".PHP_EOL;
|
echo microtime(true)." 请编辑配置文件config.php,{$t}秒后继续...".PHP_EOL;
|
||||||
sleep(1);
|
sleep(1);
|
||||||
} while (--$t > 0);
|
} while (--$t > 0);
|
||||||
|
// 第一次会生成
|
||||||
|
@copy(ROOT_PATH . '/config/config.sample.php', ROOT_PATH . '/config/config.php');
|
||||||
}
|
}
|
||||||
echo microtime(true).' 全局配置载入完成!'.PHP_EOL;
|
echo microtime(true).' 全局配置载入完成!'.PHP_EOL;
|
||||||
// 读取支持列表
|
// 读取支持列表
|
||||||
|
Loading…
x
Reference in New Issue
Block a user