From 6b50b5e492fb051859f0879560a8906c76c58df4 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 21 Mar 2021 20:27:47 +0800 Subject: [PATCH] fix:downHash --- src/Library/Rpc.php | 2 +- src/Rss/AbstractRss.php | 5 ++--- src/Rss/hddolby.php | 13 +++++++++++++ src/Rss/hdhome.php | 18 +++++++++++++----- src/Rss/pthome.php | 19 +++++++++++++------ 5 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/Library/Rpc.php b/src/Library/Rpc.php index 6112b9c..d6e6624 100644 --- a/src/Library/Rpc.php +++ b/src/Library/Rpc.php @@ -33,7 +33,7 @@ class Rpc /** * 工作模式 */ - protected static $workingMode = ''; + protected static $workingMode = 0; /** * 种子存放路径 (斜杠结尾) */ diff --git a/src/Rss/AbstractRss.php b/src/Rss/AbstractRss.php index c6a0384..bb1f8c3 100644 --- a/src/Rss/AbstractRss.php +++ b/src/Rss/AbstractRss.php @@ -103,7 +103,7 @@ abstract class AbstractRss /** * 解析命令行参数 【静态方法】 * @param string $uuid 任务标识 - * @return string 文件名 + * @return string 类文件名 */ protected static function getCliInput($uuid) { @@ -120,8 +120,7 @@ abstract class AbstractRss echo microtime(true).' 命令行参数解析完成!'.PHP_EOL; //cli(self::$conf); $siteName = self::$conf['site']['name']; - $filename = isset(self::SITENAME_TO_FILENAME_MAP[$siteName]) ? self::SITENAME_TO_FILENAME_MAP[$siteName] : $siteName; - return $filename; + return isset(self::SITENAME_TO_FILENAME_MAP[$siteName]) ? self::SITENAME_TO_FILENAME_MAP[$siteName] : $siteName; } /** diff --git a/src/Rss/hddolby.php b/src/Rss/hddolby.php index ae4b786..a5c361b 100644 --- a/src/Rss/hddolby.php +++ b/src/Rss/hddolby.php @@ -17,6 +17,19 @@ class hddolby extends AbstractRss */ public $site = 'hddolby'; + /** + * 初始化 第二步 + */ + public function init() + { + //站点配置 + $config = static::$conf['site']; + $this->cookies = isset($config['cookie']) && $config['cookie'] ? $config['cookie'] : ''; + $this->passkey = isset($config['downHash']) && $config['downHash'] ? $config['downHash'] : ''; + if (empty($this->passkey)) { + die($this->site.' 没有配置密钥,初始化错误。'.PHP_EOL); + } + } /** * 抽象方法,在类中实现 * 解码html为种子数组 diff --git a/src/Rss/hdhome.php b/src/Rss/hdhome.php index 11d119b..b28cc07 100644 --- a/src/Rss/hdhome.php +++ b/src/Rss/hdhome.php @@ -4,11 +4,6 @@ */ namespace IYUU\Rss; -use Curl\Curl; -use DOMDocument; -use DOMXpath; -use IYUU\Library\Rpc; - class hdhome extends AbstractRss { /** @@ -19,6 +14,19 @@ class hdhome extends AbstractRss public static $official = array('HDHome','HDH','HDHTV','HDHPad','HDHWEB'); + /** + * 初始化 第二步 + */ + public function init() + { + //站点配置 + $config = static::$conf['site']; + $this->cookies = isset($config['cookie']) && $config['cookie'] ? $config['cookie'] : ''; + $this->passkey = isset($config['downHash']) && $config['downHash'] ? $config['downHash'] : ''; + if (empty($this->passkey)) { + die($this->site.' 没有配置密钥,初始化错误。'.PHP_EOL); + } + } /** * 抽象方法,在类中实现 * 解码html为种子数组 diff --git a/src/Rss/pthome.php b/src/Rss/pthome.php index 3ef3447..a6b7db6 100644 --- a/src/Rss/pthome.php +++ b/src/Rss/pthome.php @@ -4,11 +4,6 @@ */ namespace IYUU\Rss; -use Curl\Curl; -use DOMDocument; -use DOMXpath; -use IYUU\Library\Rpc; - class pthome extends AbstractRss { /** @@ -16,8 +11,20 @@ class pthome extends AbstractRss * @var string */ public $site = 'pthome'; - public $rss_page = 'torrentrss.php?rows=50&exp=180&linktype=dl&passkey={}'; + /** + * 初始化 第二步 + */ + public function init() + { + //站点配置 + $config = static::$conf['site']; + $this->cookies = isset($config['cookie']) && $config['cookie'] ? $config['cookie'] : ''; + $this->passkey = isset($config['downHash']) && $config['downHash'] ? $config['downHash'] : ''; + if (empty($this->passkey)) { + die($this->site.' 没有配置密钥,初始化错误。'.PHP_EOL); + } + } /** * 抽象方法,在类中实现 * 解码html为种子数组