Compare commits

..

4 Commits

Author SHA1 Message Date
iyuu.cn
32ec80d552 提高对旧配置的兼容性 2020-07-14 02:13:20 +08:00
iyuu.cn
2b989f9e0e 新增瓷器、城市cookie过期微信通知 2020-07-13 10:19:36 +08:00
iyuu.cn
ff16781da9 fix 2020-07-13 08:47:00 +08:00
iyuu.cn
6a01b492ce 更新公告栏 2020-07-13 07:58:39 +08:00
7 changed files with 54 additions and 19 deletions

View File

@@ -1,17 +1,19 @@
<?php <?php
namespace IYUU; namespace IYUU;
use Curl\Curl; use Curl\Curl;
use IYUU\Client\AbstractClient; use IYUU\Client\AbstractClient;
use IYUU\Library\IFile; use IYUU\Library\IFile;
use IYUU\Library\Oauth; use IYUU\Library\Oauth;
use IYUU\Library\Table; use IYUU\Library\Table;
/** /**
* IYUUAutoReseed自动辅种类 * IYUUAutoReseed自动辅种类
*/ */
class AutoReseed class AutoReseed
{ {
// 版本号 // 版本号
const VER = '1.9.1'; const VER = '1.9.3';
// RPC连接 // RPC连接
private static $links = []; private static $links = [];
// 客户端配置 // 客户端配置
@@ -420,7 +422,7 @@ class AutoReseed
if ($lastTime) { if ($lastTime) {
$interval = time() - $lastTime; // 间隔时间 $interval = time() - $lastTime; // 间隔时间
if ($interval < $limitRule['sleep']) { if ($interval < $limitRule['sleep']) {
$t = $limitRule['sleep'] - $interval + mt_rand(1,5); $t = $limitRule['sleep'] - $interval + mt_rand(1, 5);
do { do {
echo microtime(true)." 为账号安全,辅种进程休眠 {$t} 秒后继续...".PHP_EOL; echo microtime(true)." 为账号安全,辅种进程休眠 {$t} 秒后继续...".PHP_EOL;
sleep(1); sleep(1);
@@ -450,6 +452,7 @@ class AutoReseed
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)) { if (empty($details_html)) {
ff($siteName. '站点cookie已过期请更新后重新辅种');
echo 'cookie已过期请更新后重新辅种已加入排除列表'.PHP_EOL; echo 'cookie已过期请更新后重新辅种已加入排除列表'.PHP_EOL;
$t = 30; $t = 30;
do { do {
@@ -469,7 +472,9 @@ 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已过期请更新后重新辅种');
echo 'cookie已过期请更新后重新辅种'.PHP_EOL; echo 'cookie已过期请更新后重新辅种'.PHP_EOL;
$configALL[$siteName]['cookie'] = '';
$reseedPass = true; $reseedPass = true;
break; break;
} }
@@ -517,6 +522,13 @@ class AutoReseed
$html = download($protocol .$sites[$sid]['base_url']. '/pt', $cookie, $userAgent); $html = download($protocol .$sites[$sid]['base_url']. '/pt', $cookie, $userAgent);
// 提取种子下载地址 // 提取种子下载地址
$offset = strpos($html, 'cuhash='); $offset = strpos($html, 'cuhash=');
if ($offset === false) {
ff($siteName. '站点cookie已过期请更新后重新辅种');
echo 'cookie已过期请更新后重新辅种'.PHP_EOL;
$configALL[$siteName]['cookie'] = '';
$reseedPass = true;
break;
}
$len = strlen('cuhash='); $len = strlen('cuhash=');
$cuhashTemp = substr($html, $offset+$len, 40); $cuhashTemp = substr($html, $offset+$len, 40);
$configALL[$siteName]['cuhash'] = substr($cuhashTemp, 0, strpos($cuhashTemp, '"')); $configALL[$siteName]['cuhash'] = substr($cuhashTemp, 0, strpos($cuhashTemp, '"'));
@@ -762,8 +774,7 @@ class AutoReseed
$path_selector = isset($configALL['default']['move']['path_selector']) && !empty($configALL['default']['move']['path_selector']) ? $configALL['default']['move']['path_selector'] : null; $path_selector = isset($configALL['default']['move']['path_selector']) && !empty($configALL['default']['move']['path_selector']) ? $configALL['default']['move']['path_selector'] : null;
if (\is_null($path_filter) && \is_null($path_selector)) { if (\is_null($path_filter) && \is_null($path_selector)) {
return false; return false;
} } elseif (\is_null($path_filter)) {
elseif (\is_null($path_filter)) {
//选择器 //选择器
if (\is_array($path_selector)) { if (\is_array($path_selector)) {
foreach ($path_selector as $pathName) { foreach ($path_selector as $pathName) {
@@ -774,8 +785,7 @@ class AutoReseed
echo '已跳过!转移选择器未匹配到:'.$path.PHP_EOL; echo '已跳过!转移选择器未匹配到:'.$path.PHP_EOL;
return true; return true;
} }
} } elseif (\is_null($path_selector)) {
elseif (\is_null($path_selector)) {
//过滤器 //过滤器
if (\is_array($path_filter)) { if (\is_array($path_filter)) {
foreach ($path_filter as $pathName) { foreach ($path_filter as $pathName) {
@@ -812,18 +822,18 @@ class AutoReseed
/** /**
* 获取站点种子的URL * 获取站点种子的URL
* @param string $site * @param string $site
* @param string $_url * @param string $url
* @return string * @return string
*/ */
private static function getTorrentUrl($site = '', $_url = '') private static function getTorrentUrl($site = '', $url = '')
{ {
global $configALL; global $configALL;
// 兼容旧配置 // 兼容旧配置
if (isset($configALL[$site]['passkey']) && $configALL[$site]['passkey']) { if (isset($configALL[$site]['passkey']) && $configALL[$site]['passkey']) {
if (!isset($configALL[$site]['url_replace'])) { if (empty($configALL[$site]['url_replace'])) {
$configALL[$site]['url_replace'] = array('{passkey}' => $configALL[$site]['passkey']); $configALL[$site]['url_replace'] = array('{passkey}' => $configALL[$site]['passkey']);
} }
if (!isset($configALL[$site]['url_join'])) { if (empty($configALL[$site]['url_join'])) {
$configALL[$site]['url_join'] = array(); $configALL[$site]['url_join'] = array();
if (in_array($site, array('m-team','mocat','hdbd'))) { if (in_array($site, array('m-team','mocat','hdbd'))) {
if (isset($configALL[$site]['ip_type'])) { if (isset($configALL[$site]['ip_type'])) {
@@ -835,11 +845,11 @@ class AutoReseed
} }
// 通用操作:替换 // 通用操作:替换
if (isset($configALL[$site]['url_replace']) && $configALL[$site]['url_replace']) { if (isset($configALL[$site]['url_replace']) && $configALL[$site]['url_replace']) {
$url = strtr($_url, $configALL[$site]['url_replace']); $url = strtr($url, $configALL[$site]['url_replace']);
} }
// 通用操作:拼接 // 通用操作:拼接
if (isset($configALL[$site]['url_join']) && $configALL[$site]['url_join']) { if (isset($configALL[$site]['url_join']) && $configALL[$site]['url_join']) {
$url = $url.(strpos($url, '?') === false ? '?' : '&').implode('&',$configALL[$site]['url_join']); $url = $url.(strpos($url, '?') === false ? '?' : '&').implode('&', $configALL[$site]['url_join']);
} }
return $url; return $url;
} }

View File

@@ -1,5 +1,6 @@
<?php <?php
namespace IYUU\Library; namespace IYUU\Library;
/** /**
* @class IFile * @class IFile
* @brief IFile 文件处理类 * @brief IFile 文件处理类

View File

@@ -1,6 +1,8 @@
<?php <?php
namespace IYUU\Library; namespace IYUU\Library;
use Curl\Curl; use Curl\Curl;
/** /**
* IYUU用户注册、认证 * IYUU用户注册、认证
*/ */

View File

@@ -1,5 +1,6 @@
<?php <?php
namespace IYUU\Library; namespace IYUU\Library;
/** /**
* Created by PhpStorm. * Created by PhpStorm.
* User: 大卫 * User: 大卫

View File

@@ -1,6 +1,7 @@
<?php <?php
use IYUU\Library\IFile; use IYUU\Library\IFile;
use IYUU\Library\Table; use IYUU\Library\Table;
/** /**
* 调试函数 * 调试函数
* @param $data * @param $data

View File

@@ -26,6 +26,7 @@
require_once __DIR__ . '/init.php'; require_once __DIR__ . '/init.php';
echo '当前脚本路径:'.__FILE__.PHP_EOL; echo '当前脚本路径:'.__FILE__.PHP_EOL;
use IYUU\AutoReseed; use IYUU\AutoReseed;
AutoReseed::init(); AutoReseed::init();
AutoReseed::call(); AutoReseed::call();
exit(0); exit(0);

View File

@@ -1,5 +1,24 @@
# 公告栏 # 公告栏
### 2020年7月13日08:00:00
【更新提醒】v1.9.1
优化App.Api.Sites接口请求时携带版本号版本为空或低于v1.9.1会返回旧数据);
新增:异步间隔流控算法,适用所有站点;各站独立、执行时间最优;
【升级方法】
1.异步间隔流控使用方法参考v1.9.1版本的config.sample.php[第242-245行]把他复制到你想应用流控的站点配置项内解释count表示每次辅种的最大数量sleep表示当前站点每次下载种子最小间隔多少秒。
2.url_replace和url_join是为了最大化兼容未来各种类型站点提前准备的可以自定义URL
解释url_replace是替换下载链接时使用让下载链接支持替换任意参数。举例'url_replace'=>array('{passkey}'=>'123456789'), 下载链接https://pt.baidu.com/download.php?id={}&passkey={passkey}替换后变为https://pt.baidu.com/download.php?id={}&passkey=123456789
解释url_join是拼接下载链接是使用让下载链接支持任意自定义参数。举例
'url_join' => array('ipv6=1','https=1'), 下载链接https://pt.baidu.com/download.php?id={}&passkey=123456789拼接后变为https://pt.baidu.com/download.php?id={}&passkey=123456789&ipv6=1&https=1
### 2020年7月12日19:34:03 ### 2020年7月12日19:34:03
【新增功能】v1.9.0 【新增功能】v1.9.0