mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-05-23 10:05:23 +00:00
fix:优化代码
This commit is contained in:
parent
87f06ec5c4
commit
6b83e9081b
@ -410,11 +410,11 @@ class AutoReseed
|
|||||||
* 种子URL组合方式区分
|
* 种子URL组合方式区分
|
||||||
*/
|
*/
|
||||||
$url = self::getTorrentUrl($siteName, $_url);
|
$url = self::getTorrentUrl($siteName, $_url);
|
||||||
$reseedPass = false;
|
$reseedPass = false; // 标志:跳过辅种
|
||||||
// 特殊站点:种子元数据推送给下载器
|
// 特殊站点:种子元数据推送给下载器
|
||||||
switch ($siteName) {
|
switch ($siteName) {
|
||||||
case 'hdchina':
|
case 'hdchina':
|
||||||
$cookie = isset($configALL[$siteName]['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');
|
||||||
@ -429,30 +429,32 @@ class AutoReseed
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
} while (--$t > 0);
|
} while (--$t > 0);
|
||||||
$configALL[$siteName]['cookie'] = '';
|
$configALL[$siteName]['cookie'] = '';
|
||||||
// 标志:跳过辅种
|
|
||||||
$reseedPass = true;
|
$reseedPass = true;
|
||||||
break;
|
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');
|
||||||
// 标志:跳过辅种
|
|
||||||
$reseedPass = true;
|
$reseedPass = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 提取种子下载地址
|
// 提取种子下载地址
|
||||||
$download_page = str_replace('{}', '', $sites[$sid]['download_page']);
|
$download_page = str_replace('{}', '', $sites[$sid]['download_page']);
|
||||||
$offset = strpos($details_html, $download_page);
|
$offset = strpos($details_html, $download_page);
|
||||||
$urlTemp = substr($details_html, $offset, 50);
|
if ($offset === false) {
|
||||||
// 种子地址
|
echo 'cookie已过期,请更新后重新辅种!'.PHP_EOL;
|
||||||
$_url = substr($urlTemp, 0, strpos($urlTemp, '">'));
|
|
||||||
if (empty($_url)) {
|
|
||||||
echo '未知错误,未提取到种子URL,请联系脚本作者!'.PHP_EOL;
|
|
||||||
// 标志:跳过辅种
|
|
||||||
$reseedPass = true;
|
$reseedPass = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$_url = 'https://' .$sites[$sid]['base_url']. '/' . $_url;
|
$urlTemp = substr($details_html, $offset, 50);
|
||||||
|
// 种子地址
|
||||||
|
$hash = substr($urlTemp, 0, strpos($urlTemp, '">'));
|
||||||
|
if (empty($hash)) {
|
||||||
|
echo '未知错误,未提取到种子URL,请联系脚本作者!'.PHP_EOL;
|
||||||
|
$reseedPass = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$_url = 'https://' .$sites[$sid]['base_url']. '/' . $hash;
|
||||||
print "种子下载页:".$_url.PHP_EOL;
|
print "种子下载页:".$_url.PHP_EOL;
|
||||||
$url = download($_url, $cookie, $userAgent);
|
$url = download($_url, $cookie, $userAgent);
|
||||||
#p($url);
|
#p($url);
|
||||||
@ -466,7 +468,6 @@ class AutoReseed
|
|||||||
} while (--$t > 0);
|
} while (--$t > 0);
|
||||||
ff($siteName. '站点,辅种时触发第一次下载提示!');
|
ff($siteName. '站点,辅种时触发第一次下载提示!');
|
||||||
self::$noReseed[] = 'hdchina';
|
self::$noReseed[] = 'hdchina';
|
||||||
// 标志:跳过辅种
|
|
||||||
$reseedPass = true;
|
$reseedPass = true;
|
||||||
}
|
}
|
||||||
if (strpos($url, '系统检测到过多的种子下载请求') != false) {
|
if (strpos($url, '系统检测到过多的种子下载请求') != false) {
|
||||||
@ -474,12 +475,11 @@ class AutoReseed
|
|||||||
ff($siteName. '站点,辅种时触发人机验证!');
|
ff($siteName. '站点,辅种时触发人机验证!');
|
||||||
$configALL[$siteName]['limit'] = 1;
|
$configALL[$siteName]['limit'] = 1;
|
||||||
self::$noReseed[] = 'hdchina';
|
self::$noReseed[] = 'hdchina';
|
||||||
// 标志:跳过辅种
|
|
||||||
$reseedPass = true;
|
$reseedPass = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'hdcity':
|
case 'hdcity':
|
||||||
$cookie = isset($configALL[$siteName]['cookie']) ? $configALL[$siteName]['cookie'] : '';
|
$cookie = $configALL[$siteName]['cookie'];
|
||||||
$userAgent = $configALL['default']['userAgent'];
|
$userAgent = $configALL['default']['userAgent'];
|
||||||
print "种子:".$_url.PHP_EOL;
|
print "种子:".$_url.PHP_EOL;
|
||||||
if (isset($configALL[$siteName]['cuhash'])) {
|
if (isset($configALL[$siteName]['cuhash'])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user