新增:支持站点ptp(皮)辅种,皮RSS下载

This commit is contained in:
david 2021-08-24 11:02:37 +08:00
parent da5eed61f8
commit d6202d029b
3 changed files with 67 additions and 6 deletions

14
docs/help.md Normal file
View File

@ -0,0 +1,14 @@
IYUUPlus安装篇--群晖docker
https://www.iyuu.cn/archives/426/
IYUUPlus安装篇--威联通docker
https://www.iyuu.cn/archives/447/
IYUUPlus安装篇--Arm平台命令行安装
https://www.iyuu.cn/archives/427/
IYUUPlus安装篇--Windows
https://www.iyuu.cn/archives/429/
IYUUPlus使用篇-转移做种客户端
https://www.iyuu.cn/archives/451/

View File

@ -232,6 +232,7 @@
break;
case 'greatposterwall':
case 'dicmusic':
case 'ptpbd':
rule.passkey.visible = false;
rule.torrent_pass.visible = true;
rule.authkey.visible = true;

View File

@ -2,6 +2,7 @@
namespace IYUU\Rss;
use DOMDocument;
use Exception;
class ptpbd extends AbstractRss
{
@ -11,6 +12,42 @@ class ptpbd extends AbstractRss
*/
public $site = 'ptpbd';
/**
* 用户必须自己配置rss地址
* @var string
*/
public $rss_page = '';
/**
* 抽象方法,在类中实现
* 请求url获取html页面
* @param string $url
* @return string|null
*/
public function get($url = '')
{
// 1. 入口参数为准
if ($url == '') {
$url = $this->rss_page;
}
// 2. 读取配置
if ($rss_page = self::$conf['urladdress'] ?? '') {
$url = $rss_page;
}
if (empty($url)) {
die('缺少 rss.page 配置');
}
echo $this->site." 正在请求RSS... {$url}". PHP_EOL;
$res = $this->curl->get($this->host . $url);
if ($res->http_status_code == 200) {
echo "RSS获取信息成功 \n";
return $res->response;
}
echo "RSS获取信息失败请重试 \n";
return null;
}
/**
* 抽象方法,在类中实现
* 解码html为种子数组
@ -31,8 +68,17 @@ class ptpbd extends AbstractRss
$guid = $item->getElementsByTagName('guid')->item(0) != null ? md5($item->getElementsByTagName('guid')->item(0)->nodeValue) : md5($link);
$details = $item->getElementsByTagName('comments')->item(0)->nodeValue;
$time = strtotime($item->getElementsByTagName('pubDate')->item(0)->nodeValue);
// 提取id
$id = strrchr($details, '=');
// 提取种子id
if (preg_match('/id=(\d+)/i', $link, $match)) {
$id = $match[1];
} else {
continue;
}
// 提取种子分组id
if (preg_match('/id=(\d+)/i', $details, $match)) {
$group_id = $match[1];
$torrent['group_id'] = $group_id;
}
$torrent['id'] = $id;
$torrent['h1'] = $item->getElementsByTagName('title')->item(0)->nodeValue;
$torrent['title'] = '';
@ -44,11 +90,11 @@ class ptpbd extends AbstractRss
$torrent['guid'] = $guid;
$items[] = $torrent;
}
#p($items);
#exit;
//p($items);
//exit;
return $items;
} catch (\Exception $e) {
die('[AbstractRss ERROR] ' . $e->getMessage() . PHP_EOL);
} catch (Exception $e) {
die(__METHOD__ . ' [ERROR] ' . $e->getMessage() . PHP_EOL);
}
}
}