mirror of
https://github.com/ledccn/IYUUPlus.git
synced 2024-09-20 15:15:29 +00:00
优化:支持馒头配置URL附加参数
This commit is contained in:
parent
436fa628ac
commit
c3982530b7
|
@ -189,7 +189,7 @@ class Api extends BaseController
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取所有RSS支持的站点
|
||||
* 获取所有免费种爬虫支持的站点
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,6 @@ namespace app\domain\ConfigParser;
|
|||
|
||||
use app\domain\ConfigParserInterface;
|
||||
use app\domain\Config;
|
||||
use IYUU\Spiders\SitesBase;
|
||||
|
||||
class Rss implements ConfigParserInterface
|
||||
{
|
||||
|
@ -65,6 +64,8 @@ class Rss implements ConfigParserInterface
|
|||
|
||||
//其他参数
|
||||
$rs = array_merge($cron, $rs);
|
||||
} else {
|
||||
$rs = [];
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
namespace app\domain\ConfigParser;
|
||||
|
||||
use app\domain\ConfigParserInterface;
|
||||
use app\domain\Config;
|
||||
use IYUU\Spiders\SitesBase;
|
||||
|
||||
class Spiders implements ConfigParserInterface
|
||||
|
|
1
src/Sites/.gitignore
vendored
1
src/Sites/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
!.gitignore
|
|
@ -2,7 +2,7 @@
|
|||
namespace IYUU\Spiders;
|
||||
|
||||
use app\common\Constant;
|
||||
use app\domain\ConfigParser\Rss as domainRss;
|
||||
use app\domain\ConfigParser\Spiders as domainSpiders;
|
||||
use IYUU\Library\Rpc;
|
||||
use IYUU\Library\Selector;
|
||||
/**
|
||||
|
@ -63,7 +63,10 @@ class SitesBase
|
|||
*/
|
||||
public static function getCliInput($uuid)
|
||||
{
|
||||
self::$conf = domainRss::parser($uuid);
|
||||
self::$conf = domainSpiders::parser($uuid);
|
||||
if (empty(self::$conf)) {
|
||||
die('当前任务不存在或者未开启。'.PHP_EOL);
|
||||
}
|
||||
if (empty(self::$conf['site'])) {
|
||||
die('解析计划任务失败:用户未配置的站点。'.PHP_EOL);
|
||||
}
|
||||
|
@ -74,7 +77,7 @@ class SitesBase
|
|||
die('解析计划任务失败:当前下载器可能已经删除,请编辑站点爬虫下载任务,重选下载器。'.PHP_EOL);
|
||||
}
|
||||
echo microtime(true).' 命令行参数解析完成!'.PHP_EOL;
|
||||
//cli(self::$conf);
|
||||
//cli(self::$conf, true);
|
||||
/**
|
||||
* 初始化最关键的2个参数
|
||||
*/
|
||||
|
@ -175,6 +178,21 @@ class SitesBase
|
|||
return $cookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得用户配置中的站点下载种子时候的附加参数
|
||||
* - 例如:https=1&ipv6=1
|
||||
* @return string
|
||||
*/
|
||||
protected static function getUrlJoin():string
|
||||
{
|
||||
//站点配置
|
||||
$config = self::$conf['site'];
|
||||
if (!empty($config['url_join'])) {
|
||||
return http_build_query($config['url_join']);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 取站点下载种子时使用的方法(post/get)
|
||||
* @param string $site_name
|
||||
|
@ -249,6 +267,7 @@ class SitesBase
|
|||
*/
|
||||
public static function run()
|
||||
{
|
||||
//cli(static::$conf, true);exit;
|
||||
Rpc::init(static::$site_name, static::getTorrentDownloadMethod(static::$site_name), static::$conf);
|
||||
$html = static::get();
|
||||
if (empty($html)) {
|
||||
|
|
|
@ -60,6 +60,8 @@ class mteam extends SitesBase
|
|||
*/
|
||||
public static function decode($data = array())
|
||||
{
|
||||
$url_join = static::getUrlJoin();
|
||||
$url_join = empty($url_join) ? '' : '&' . $url_join;
|
||||
foreach ($data as $k => $v) {
|
||||
$arr = array();
|
||||
// 种子id
|
||||
|
@ -86,9 +88,10 @@ class mteam extends SitesBase
|
|||
if ($h2_offset === false) {
|
||||
$arr['title'] = '';
|
||||
} else {
|
||||
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
|
||||
$h2_startOffset = $h2_offset + strlen($h2StrStart);
|
||||
$h2_len = strlen($temp) - $h2_startOffset;
|
||||
//存在副标题
|
||||
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
|
||||
$arr['title'] = substr($temp, $h2_startOffset, $h2_len);
|
||||
// 第二次过滤
|
||||
$arr['title'] = strip_tags($arr['title']);
|
||||
}
|
||||
|
@ -98,7 +101,7 @@ class mteam extends SitesBase
|
|||
self::$TorrentList[$k]['h1'] = $arr['h1'];
|
||||
self::$TorrentList[$k]['title'] = isset($arr['title']) && $arr['title'] ? $arr['title'] : '';
|
||||
self::$TorrentList[$k]['details'] = static::getHost() . self::detailsPrefix . $arr['id'];
|
||||
self::$TorrentList[$k]['download'] = static::getHost() . $arr['url'];
|
||||
self::$TorrentList[$k]['download'] = static::getHost() . $arr['url'] . $url_join;
|
||||
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
|
||||
|
||||
// 种子促销类型解码
|
||||
|
|
Loading…
Reference in New Issue
Block a user