IYUU自动辅种工具初始化版本

This commit is contained in:
iyuu.cn
2019-12-22 00:00:00 +08:00
commit e81d66869a
133 changed files with 33246 additions and 0 deletions

198
app/Protocols/0.sample.php Normal file
View File

@ -0,0 +1,198 @@
<?php
/**
* hdarea解码类
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Hdarea implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'hdarea';
/**
* 域名
* @var string
*/
const domain = 'www.hdarea.co';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
#p($html);exit;
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '<td width="80" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
$arr['title'] = str_replace("\n","",$arr['title']);
// 第二次过滤
if ( strpos($arr['title'],'</td>') != false ) {
$arr['title'] = str_replace('</td>',"",$arr['title']);
}
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

194
app/Protocols/beitai.php Normal file
View File

@ -0,0 +1,194 @@
<?php
/**
* www.beitai.pt解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Beitai implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'beitai';
/**
* 域名
* @var string
*/
const domain = 'www.beitai.pt';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="20" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 第二次过滤
#code...
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);exit;
return self::$TorrentList;
}
}

195
app/Protocols/brobits.php Normal file
View File

@ -0,0 +1,195 @@
<?php
/**
* brobits解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Brobits implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'brobits';
/**
* 域名
* @var string
*/
const domain = 'brobits.cc';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="20" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 第二次过滤
#code...
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

217
app/Protocols/btschool.php Normal file
View File

@ -0,0 +1,217 @@
<?php
/**
* pt.btschool.club解码类
* Extreme User及以上用户会永远保留账号。必须注册至少60周并且下载至少2TB分享率大于3.55。[7.1TB保号]
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Btschool implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'btschool';
/**
* 域名
* @var string
*/
const domain = 'pt.btschool.club';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br/>';
$h2StrEnd = '</td><td width="50" class="embedded"';
$h2_offset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_offset);
$h2_offset = strrpos($temp,$h2StrStart);
//p($temp);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$titleTemp = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
//二次过滤
$titleTemp = selector::remove($titleTemp, "//a"); //编码标签
$titleTemp = selector::remove($titleTemp, "//div"); //做种标签
if ( strpos($titleTemp,'<div ') != false ) {
$titleTemp = substr($titleTemp, 0, strpos($titleTemp,'<div '));
}
// 精确适配标签 begin
$titleSpan = '';
$title = selector::remove($titleTemp, "//span");
$span = selector::select($titleTemp, '//span');
if(!empty($span)){
if(is_array($span)){
foreach ( $span as $vv ){
if( empty($vv) ){
continue;
}
$titleSpan.='['.$vv.'] ';
}
}else{
$titleSpan.='['.$span.'] ';
}
}
// 精确适配标签 end
$arr['title'] = $titleSpan . $title;
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

217
app/Protocols/chdbits.php Normal file
View File

@ -0,0 +1,217 @@
<?php
/**
* chdbits.co解码类
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Chdbits implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'chdbits';
/**
* 域名
* @var string
*/
const domain = 'chdbits.co';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free','title="免费"');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="50" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$titleTemp = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 第二次过滤
// 精确适配标签 begin
$titleSpan = '';
$title = selector::remove($titleTemp, "//div");
$span = selector::select($titleTemp, '//div');
if(!empty($span)){
if(is_array($span)){
foreach ( $span as $vv ){
if( empty($vv) || (strpos($titleTemp,'<div') != false) ){
continue;
}
$titleSpan.='['.$vv.'] ';
}
}else{
$titleSpan.='['.$span.'] ';
}
}
// 精确适配标签 end
// 最后过滤
if ( strpos($title,'<font') != false ) {
$offset = 0;
$offset = strpos($title,'>')+1;
$title = substr($title, $offset);
}
$title = str_replace('</font>',"",$title);
$arr['title'] = $titleSpan . $title;
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* 定义站点解码类接口
*/
interface decodeBase
{
/**
* 初始化配置
*/
public static function init();
/**
* 执行
*
* @param string
* @return array
*/
public static function run();
/**
* 接口方法,在类中实现
* 请求url获取html页面
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php');
/**
* 接口方法,在类中实现
* 解码html为种子数组
* @param array $html
* @return array
* Array
(
[id] => 118632
[h1] => CCTV5+ 2019 ATP Men's Tennis Final 20191115B HDTV 1080i H264-HDSTV
[title] => 央视体育赛事频道 2019年ATP男子网球年终总决赛 单打小组赛 纳达尔VS西西帕斯 20191115[优惠剩余时间4时13分]
[details] => https://hdsky.me/details.php?id=118632
[download] => https://hdsky.me/download.php?id=118632
[filename] => 118632.torrent
[type] => 0
[sticky] => 1
[time] => Array
(
[0] => "2019-11-16 20:41:53">4时13分
[1] => "2019-11-16 14:41:53">1时<br />46分
)
[comments] => 0
[size] => 5232.64MB
[seeders] => 69
[leechers] => 10
[completed] => 93
[percentage] => 100%
[owner] => 匿名
)
*/
public static function decode($html = array());
}

195
app/Protocols/eastgame.php Normal file
View File

@ -0,0 +1,195 @@
<?php
/**
* eastgame解码类
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Eastgame implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'eastgame';
/**
* 域名
* @var string
*/
const domain = 'pt.eastgame.org';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="20" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 第二次过滤
if ( strpos($arr['title'],'</a>') != false ) {
$arr['title'] = selector::remove($arr['title'], "//a");
}
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

198
app/Protocols/hd4fans.php Normal file
View File

@ -0,0 +1,198 @@
<?php
/**
* hdarea解码类
*/
use phpspider\core\requests;
use phpspider\core\selector;
class hd4fans implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'hd4fans';
/**
* 域名
* @var string
*/
const domain = 'pt.hd4fans.org';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
#p($html);exit;
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="20" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
#$arr['title'] = str_replace("\n","",$arr['title']);
// 第二次过滤
if ( strpos($arr['title'],'</td>') != false ) {
#$arr['title'] = str_replace('</td>',"",$arr['title']);
}
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

198
app/Protocols/hdarea.php Normal file
View File

@ -0,0 +1,198 @@
<?php
/**
* hdarea解码类
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Hdarea implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'hdarea';
/**
* 域名
* @var string
*/
const domain = 'www.hdarea.co';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
#p($html);exit;
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '<td width="80" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
$arr['title'] = str_replace("\n","",$arr['title']);
// 第二次过滤
if ( strpos($arr['title'],'</td>') != false ) {
$arr['title'] = str_replace('</td>',"",$arr['title']);
}
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

198
app/Protocols/hdbug.php Normal file
View File

@ -0,0 +1,198 @@
<?php
/**
* hdbug解码类
*/
use phpspider\core\requests;
use phpspider\core\selector;
class hdbug implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'hdbug';
/**
* 域名
* @var string
*/
const domain = 'hdbug.best';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
#p($html);exit;
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="20" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
#$arr['title'] = str_replace("\n","",$arr['title']);
// 第二次过滤
if ( strpos($arr['title'],'</td>') != false ) {
#$arr['title'] = str_replace('</td>',"",$arr['title']);
}
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

205
app/Protocols/hdchina.php Normal file
View File

@ -0,0 +1,205 @@
<?php
/**
* hdchina解码类
* 未检测是否免费、未检测HR
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Hdchina implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'hdchina';
/**
* 域名
* @var string
*/
const domain = 'hdchina.org';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?hash=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='tbname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 25; // 截取长度
// hdchina特有
$idStrLen = strlen(self::detailsPrefix); // ID前缀长度
$idStrEnd = '&'; // 种子地址结束标志
$idlen = $idStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id[单独计算]
$idOffset = strpos($v,self::detailsPrefix);
$idTemp = substr($v, $idOffset, $idlen);
$id = substr($idTemp,0,strpos($idTemp,$idStrEnd));
$arr['id'] = substr($id,$idStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<h4>';
$h2StrEnd = '</h4>';
$h2_endOffset = strpos($v,$h2StrEnd);
if ($h2_endOffset === false) {
$arr['title'] = '';
}else {
// 方法一
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
// 副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 方法二 [直取副标题]
#$arr['title'] = selector::select($v, '//h4');
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码 【未检测是否免费】
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

194
app/Protocols/hddolby.php Normal file
View File

@ -0,0 +1,194 @@
<?php
/**
* www.hddolby.com解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Hddolby implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'hddolby';
/**
* 域名
* @var string
*/
const domain = 'www.hddolby.com';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="20" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 第二次过滤
#code...
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);exit;
return self::$TorrentList;
}
}

228
app/Protocols/hdhome.php Normal file
View File

@ -0,0 +1,228 @@
<?php
/**
* hdhome.org解码类
* 特殊说明是H&R的种子不管是否免费都会自动过滤。
* Nexus Master及以上用户会永远保留账号。必须注册至少10周并且下载至少8TB分享率大于5.50。[44TB保号]
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Hdhome implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'hdhome';
/**
* 域名
* @var string
*/
const domain = 'hdhome.org';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志 class="hitandrun" 或者 title="H&amp;R"
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
* Array
(
[id] => 118632
[h1] => CCTV5+ 2019 ATP Men's Tennis Final 20191115B HDTV 1080i H264-HDSTV
[title] => 央视体育赛事频道 2019年ATP男子网球年终总决赛 单打小组赛 纳达尔VS西西帕斯 20191115[优惠剩余时间4时13分]
[details] => https://hdsky.me/details.php?id=118632
[download] => https://hdsky.me/download.php?id=118632
[filename] => 118632.torrent
[type] => 0
[sticky] => 1
[time] => Array
(
[0] => "2019-11-16 20:41:53">4时13分
[1] => "2019-11-16 14:41:53">1时<br />46分
)
[comments] => 0
[size] => 5232.64MB
[seeders] => 69
[leechers] => 10
[completed] => 93
[percentage] => 100%
[owner] => 匿名
)
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="20" class="embedded"';
$h2_offset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_offset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 第二次过滤
#code...
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// H&R检测
foreach ( self::$HR as $hrV ){
if(strpos($v,$hrV) != false){
self::$TorrentList[$k]['hr'] = 1;
// 删除
#unset( self::$TorrentList[$k] );
break;
}
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

307
app/Protocols/hdsky.php Normal file
View File

@ -0,0 +1,307 @@
<?php
/**
* hdsky.me解码类
* 明星(Veteran User)及以上用户会永远保留账号, 必须注册至少25周并且下载至少4TB分享率大于4.0。[16TB保号]
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Hdsky implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'hdsky';
/**
* 域名
* @var string
*/
const domain = 'hdsky.me';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'POST';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* 促销时间特征
*/
public static $proTime = '优惠剩余时间';
/**
* 置顶标志
*/
public static $sticky = 'title="置顶"';
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data1 = selector::select($html, "//*[@class='stickbg progresstr']");
$data2 = selector::select($html, "//*[@class='progresstr']");
if (empty($data1)) {
$data = $data2;
}else{
$data = array_merge($data1, $data2);
}
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题
// 偏移量
$h2_offset = strpos($v,'<br />') + strlen('<br />');
$h2_len = strpos($v,'</td><td width="32"',$h2_offset) - $h2_offset;
if($h2_len > 0){
//存在副标题
$titleTemp = substr($v, $h2_offset, $h2_len);
$titleSpan = '';
$title = selector::remove($titleTemp, "//span");
// 精确适配标签 begin
$span = selector::select($titleTemp, '//span');
if(!empty($span)){
if(is_array($span)){
// 查询促销时间特征
if(strpos($title, self::$proTime) != false){
$key = count($span);
// 替换占位符
$title = str_replace('<b></b>',$span[$key-1],$title);
// 适配
unset($span[$key-1]);
}
foreach ( $span as $vv ){
$titleSpan.='['.$vv.'] ';
}
}else{
// 查询促销时间特征
if(strpos($title, self::$proTime) != false){
// 替换占位符
$title = str_replace('<b></b>',$span,$title);
}else {
$titleSpan.='['.$span.'] ';
}
}
}
// 精确适配标签 end
$arr['title'] = $titleSpan . $title;
#echo $arr['title'];
}else {
$arr['title'] = '';
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型discount
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
// 非免费,是否需要获取扩展信息
//continue;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 是否置顶sticky
self::$TorrentList[$k]['sticky'] = strpos($v,self::$sticky)===false ? 0 : 1;
// 优惠剩余时间proTime可选
// 存活时间added必有
$added = selector::select($v, '@<span title=(.*?)</span>@', "regex");
self::$TorrentList[$k]['time'] = $added;
#p($added);
/*
Array
(
[0] => "2019-11-20 15:01:17">3天22时
[1] => "2014-09-24 00:09:20">5年<br />2月
)
string
"2016-04-24 15:43:25">3年<br />7月
*/
$options = selector::select($v, "//*[@class='rowfollow']");
#p($options);
/*
$options = Array
(
[0] => <a href="comment.php?action=add&amp;pid=118608&amp;type=torrent" title="&#x6DFB;&#x52A0;&#x8BC4;&#x8BBA;">0</a>
[1] => 7.11<br/>GB
[2] => <b><a href="details.php?id=118608&amp;hit=1&amp;dllist=1#seeders"><font color="#ff0000">1</font></a></b>
[3] => <b><a href="details.php?id=118608&amp;hit=1&amp;dllist=1#leechers">105</a></b>
[4] => 0
[5] => 0%
[6] => <span class="nowrap"><a href="userdetails.php?id=70966" class="Uploader_Name"><b>r9ruibu</b></a><img class="star" src="pic/trans.gif" alt="Donor" style="margin-left: 2pt"/></span>
)
对应的:
[0] => 评论
[1] => 大小size
[2] => 种子数seeders
[3] => 下载数leechers
[4] => 完成数
[5] => 完成进度
[6] => 发布者
*/
// 0 评论comments
self::$TorrentList[$k]['comments'] = selector::select($options[0], "//a");
// 1 大小size
self::$TorrentList[$k]['size'] = str_replace('<br/>','',$options[1]);
// 2 种子数seeders
if ( empty($options[2]) ) {
$seeders = 0;
} else {
if( strpos($options[2],'</font>') === false ){
if ( strpos($options[2],'</span>') === false ) {
// 普通特征
$seeders = selector::select($options[2], "//a");
} else {
// 新种 0做种特征
$seeders = selector::select($options[2], "//span");
}
}else{
// 新种 1做种特征
$seeders = selector::select($options[2], "//font");
}
}
self::$TorrentList[$k]['seeders'] = $seeders;
// 3 下载数leechers
self::$TorrentList[$k]['leechers'] = empty($options[3]) ? 0 : selector::select($options[3], "//a");
// 4 完成数completed
self::$TorrentList[$k]['completed'] = empty($options[4]) ? 0 : selector::select($options[4], "//b");
// 5 完成百分比percentage
self::$TorrentList[$k]['percentage'] = strpos($options[5],'</b>') === false ? $options[5] : selector::select($options[5], "//b");
// 6 发布者owner
$owner = selector::select($options[6], "//b");
self::$TorrentList[$k]['owner'] = empty($owner) ? '匿名' : $owner;
#exit(0);
}
return self::$TorrentList;
}
}

198
app/Protocols/hdtime.php Normal file
View File

@ -0,0 +1,198 @@
<?php
/**
* hdtime解码类
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Hdtime implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'hdtime';
/**
* 域名
* @var string
*/
const domain = 'hdtime.org';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
#p($html);exit;
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="100" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
#$arr['title'] = str_replace("\n","",$arr['title']);
// 第二次过滤
if ( strpos($arr['title'],'</td>') != false ) {
#$arr['title'] = str_replace('</td>',"",$arr['title']);
}
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

213
app/Protocols/keepfrds.php Normal file
View File

@ -0,0 +1,213 @@
<?php
/**
* pt.keepfrds.com解码类
* 保留账号Veteran User【3.5 TB】注册60周下载量1TB、分享率3.5、魔力值640000、做种率640
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Keepfrds implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'keepfrds';
/**
* 域名
* @var string
*/
const domain = 'pt.keepfrds.com';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding;
requests::$output_encoding = self::encoding;
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(正序算法)
// 偏移量
$h2_offset = strpos($v,'<br />') + strlen('<br />');
$h2_end = strpos($v, '</td><td width="110" class="embedded"', $h2_offset);
$h2_len = $h2_end - $h2_offset;
if($h2_len > 0){
//存在副标题
$titleTemp = substr($v, $h2_offset, $h2_len);
$titleSpan = '';
// 精确适配标签 begin
// 移除标签
$title = selector::remove($titleTemp, "//b");
if ( strpos($title, '<div') != false ) {
// 移除下载进度框
$title = substr($title, 0, strpos($title, '<div'));
}
#p($title);
if ( strpos($title,'</font>') != false ) {
// 匹配红色副标题
$title = selector::select($title, '//font');
}
// 选取标签
$span = selector::select($titleTemp, "//b/font");
if(!empty($span)){
if(is_array($span)){
foreach ( $span as $vv ){
$titleSpan.='['.$vv.'] ';
}
}else{
$titleSpan.='['.$span.'] ';
}
}
// 精确适配标签 end
$arr['title'] = $titleSpan . $title;
}else{
$arr['title'] = '';
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

197
app/Protocols/leaguehd.php Normal file
View File

@ -0,0 +1,197 @@
<?php
/**
* leaguehd解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Leaguehd implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'leaguehd';
/**
* 域名
* @var string
*/
const domain = 'leaguehd.com';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free','title="2X免费"');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td class="embedded"';
$h2_offset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_offset);
$h2_offset = strrpos($temp,$h2StrStart);
#p($temp);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
//二次过滤
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

230
app/Protocols/moecat.php Normal file
View File

@ -0,0 +1,230 @@
<?php
/**
* moecat.best解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Moecat implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'moecat';
/**
* 域名
* @var string
*/
const domain = 'moecat.best';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$html = selector::select($html, "//*[@class='torrents']");
$data = selector::select($html, "//table");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
if (strpos($arr['h1'],'&#x') != false) {
$arr['h1'] = mb_convert_encoding($arr['h1'], 'UTF-8', 'HTML-ENTITIES');
}
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br/>';
$h2StrEnd = '</td><td rowspan="2" width="20"';
$h2_offset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_offset);
$h2_offset = strrpos($temp,$h2StrStart);
#p($temp);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$titleTemp = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
#p($titleTemp);
//二次过滤
$titleTemp = selector::remove($titleTemp, "//a"); //编码标签
$titleTemp = selector::remove($titleTemp, "//div"); //做种标签
$douban = '';
if ( strpos($titleTemp,"<font ") != false ) {
$douban = selector::select($titleTemp, '//font');
#p($douban);
$titleTemp = selector::remove($titleTemp, "//b"); // 移除豆瓣
#$titleTemp = substr($titleTemp, 0, strpos($titleTemp,'<div '));
}
// 精确适配标签 begin
$titleSpan = '';
$title = selector::remove($titleTemp, "//span");
$span = selector::select($titleTemp, '//span');
if(!empty($span)){
if(is_array($span)){
foreach ( $span as $vv ){
if( empty($vv) ){
continue;
}
$titleSpan.='['.$vv.'] ';
}
}else{
$titleSpan.='['.$span.'] ';
}
}
// 精确适配标签 end
$arr['title'] = $titleSpan . $title;
if ($douban != ''){
// 豆瓣放前面
$arr['title'] = $douban . $arr['title'];
}
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

194
app/Protocols/mteam.php Normal file
View File

@ -0,0 +1,194 @@
<?php
/**
* pt.m-team.cc解码类
* 府尹/Extreme User、【14 TB】必须注册至少24周并且下载至少2TB分享率大于7
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Mteam implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'm-team';
/**
* 域名
* @var string
*/
const domain = 'pt.m-team.cc';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '&'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="80"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 第二次过滤
#code...
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'].'&https=1';
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

201
app/Protocols/nanyangpt.php Normal file
View File

@ -0,0 +1,201 @@
<?php
/**
* nanyangpt解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Nanyangpt implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'nanyangpt';
/**
* 域名
* @var string
*/
const domain = 'nanyangpt.com';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" target="_blank" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd1 = '</td><td width="34" class="embedded"'; // 置顶
$h2StrEnd2 = '</td><td class="embedded" width="40px"'; // 普通
$h2_endOffset = strpos($v,$h2StrEnd1) === false ? strpos($v,$h2StrEnd2) : strpos($v,$h2StrEnd1);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$titleTemp = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
if ( strpos($titleTemp,'<span') != false ) {
$titleTemp = substr($titleTemp, 0, strpos($titleTemp,'<span'));
}
// 第二次过滤
$arr['title'] = $titleTemp;
//最后过滤
$arr['title'] = str_replace('&nbsp;',"",$arr['title']); // 过滤
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

199
app/Protocols/opencd.php Normal file
View File

@ -0,0 +1,199 @@
<?php
/**
* opencd解码类
*/
use phpspider\core\requests;
use phpspider\core\selector;
class opencd implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'opencd';
/**
* 域名
* @var string
*/
const domain = 'open.cd';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
#p($html);exit;
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="plugin_details.php') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td class="nowrap embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$temp = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
//存在副标题
if ( strpos($temp,'</font>') != false ) {
$arr['title'] = selector::select($temp, '//font');
}else{
$arr['title'] = '';
}
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

336
app/Protocols/ourbits.php Normal file
View File

@ -0,0 +1,336 @@
<?php
/**
* ourbits.club解码类
* Veteran User及以上用户会永远保留账号。必须注册至少25周并且下载至少2TB分享率大于4.0。[8TB保号]
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Ourbits implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'ourbits';
/**
* 域名
* @var string
*/
const domain = 'ourbits.club';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* 促销时间特征
*/
public static $proTime = '剩余时间:<b><span title';
/**
* 置顶标志
*/
public static $sticky = 'src="pic/sticky';
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding;
requests::$output_encoding = self::encoding;
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 一级置顶
$data1 = selector::select($html, "//*[@class='sticky_top']");
$data1 = is_array($data1) ? array_filter($data1, "evenFilter", ARRAY_FILTER_USE_KEY) : array();
// 二级置顶
$data2 = selector::select($html, "//*[@class='sticky_normal']");
$data2 = is_array($data2) ? array_filter($data2, "evenFilter", ARRAY_FILTER_USE_KEY) : array();
// 普通
$data3 = selector::select($html, "//*[@class='sticky_blank']");
$data3 = is_array($data3) ? array_filter($data3, "evenFilter", ARRAY_FILTER_USE_KEY) : array();
$mark = 0;
if( empty($data1) ){
$mark = $mark + 1;
}
if( empty($data2) ){
$mark = $mark + 2;
}
switch($mark){
case 0:
$data = array_merge($data1, $data2, $data3);
break;
case 1:
$data = array_merge($data2, $data3);
break;
case 2:
$data = array_merge($data1, $data3);
break;
case 3:
$data = $data3;
break;
default:
break;
}
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$br = '<br/>';
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 优惠时间
$proTime = '';
if ( strpos($v,self::$proTime)!=false ) {
$t_offset = strpos($v, $br);
$t_temp = substr($v, $h1_offset,$t_offset-$h1_offset);
$proTime = selector::select($t_temp, "//span");
$arr['h1'] = $arr['h1']. ' [优惠时间剩余:' .$proTime. ']';
}
// 获取副标题
// 偏移量
$h2_offset = strpos($v,$br) + strlen($br);
$h2_len = strpos($v,'</td><td class="embedded" width="30px">',$h2_offset) - $h2_offset;
if($h2_len > 0){
//存在副标题
$titleTemp = substr($v, $h2_offset, $h2_len);
$titleSpan = '';
$title = selector::remove($titleTemp, "//div");
// 精确适配标签 begin
$span = selector::select($titleTemp, '//div');
#p($span);
if(!empty($span)){
if(is_array($span)){
foreach ( $span as $vv ){
if( empty($vv) ){
continue;
}
if(strpos($vv, '<div') === false){
$titleSpan.='['.$vv.'] ';
}
}
}else{
if(strpos($vv, '<div') === false){
$titleSpan.='['.$span.'] ';
}
}
}
// 精确适配标签 end
$arr['title'] = $titleSpan . $title;
#echo $arr['title']."\n\n";
}else{
$arr['title'] = '';
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型discount
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
// 非免费,是否需要获取扩展信息
//continue;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 是否置顶sticky
self::$TorrentList[$k]['sticky'] = strpos($v,self::$sticky)===false ? 0 : 1;
// 优惠剩余时间proTime可选
// 存活时间added必有
$added = selector::select($v, '@<span title=(.*?)</span>@', "regex");
self::$TorrentList[$k]['time'] = $added;
#p($added);
/*
Array
(
[0] => "2019-11-20 15:01:17">3天22时
[1] => "2014-09-24 00:09:20">5年<br />2月
)
string
"2016-04-24 15:43:25">3年<br />7月
*/
$options = selector::select($v, "//*[@class='rowfollow']");
unset($options[0]);
$options = array_values($options);
#p($options);exit;
/*
$options = Array
(
[0] => <a href="comment.php?action=add&amp;pid=114293&amp;type=torrent" title="&#x6DFB;&#x52A0;&#x8BC4;&#x8BBA;">0</a>
[1] => 50.11<br/>GB
[2] => <b><a href="details.php?id=114293&amp;hit=1&amp;dllist=1#seeders">70</a></b>
[3] => <b><a href="details.php?id=114293&amp;hit=1&amp;dllist=1#leechers">24</a></b>
[4] => <a href="viewsnatches.php?id=114293"><b>95</b></a>
[5] => <i>匿名</i>
)
对应的:
[0] => 评论
[1] => 大小size
[2] => 种子数seeders
[3] => 下载数leechers
[4] => 完成数
[5] => 发布者
*/
// 0 评论comments
self::$TorrentList[$k]['comments'] = selector::select($options[0], "//a");
// 1 大小size
self::$TorrentList[$k]['size'] = str_replace('<br/>','',$options[1]);
// 2 种子数seeders
if ( empty($options[2]) ) {
$seeders = 0;
} else {
if( strpos($options[2],'</font>') === false ){
if ( strpos($options[2],'</span>') === false ) {
// 普通特征
$seeders = selector::select($options[2], "//a");
} else {
// 新种 0做种特征
$seeders = selector::select($options[2], "//span");
}
}else{
// 新种 1做种特征
$seeders = selector::select($options[2], "//font");
}
}
self::$TorrentList[$k]['seeders'] = $seeders;
// 3 下载数leechers
self::$TorrentList[$k]['leechers'] = empty($options[3]) ? 0 : selector::select($options[3], "//a");
// 4 完成数completed
self::$TorrentList[$k]['completed'] = empty($options[4]) ? 0 : selector::select($options[4], "//b");
// 5 完成百分比percentage
// 6 发布者owner
$owner = selector::select($options[5], "//b");
self::$TorrentList[$k]['owner'] = empty($owner) ? '匿名' : $owner;
#exit(0);
}
return self::$TorrentList;
}
}

198
app/Protocols/ptba.php Normal file
View File

@ -0,0 +1,198 @@
<?php
/**
* 1ptba解码类
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Ptba implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = '1ptba';
/**
* 域名
* @var string
*/
const domain = '1ptba.com';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
#p($html);exit;
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="20" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
#$arr['title'] = str_replace("\n","",$arr['title']);
// 第二次过滤
if ( strpos($arr['title'],'</td>') != false ) {
#$arr['title'] = str_replace('</td>',"",$arr['title']);
}
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

217
app/Protocols/pterclub.php Normal file
View File

@ -0,0 +1,217 @@
<?php
/**
* pterclub.com解码类
* 安哥拉猫(Veteran User)、【2.29 TB】、必须注册至少30周并且下载至少750G分享率大于3.05
*/
use phpspider\core\requests;
use phpspider\core\selector;
class pterclub implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'pter';
/**
* 域名
* @var string
*/
const domain = 'pterclub.com';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '&'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题 精确适配标签
// 偏移量
$h2StrStart = '<br/>';
$h2StrEnd = '</td><td class="embedded" width="6px">';
$h2_endoffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endoffset);
$h2_offset = strrpos($temp,$h2StrStart);
//p($temp);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
//存在副标题
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
$titleTemp = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
if ( strpos($titleTemp, $h2StrStart)!=false ) {
//过滤已下载、进行中等进度框
$titleTemp = substr($titleTemp, 0, strpos($titleTemp, $h2StrStart));
}
// 精确适配标签 begin
$titleSpan = '';
$title = selector::remove($titleTemp, "//div");
$span = selector::select($titleTemp, '//a');
if(!empty($span)){
if(is_array($span)){
foreach ( $span as $vv ){
if( empty($vv) ){
continue;
}
$titleSpan.='['.$vv.'] ';
}
}else{
$titleSpan.='['.$span.'] ';
}
}
// 精确适配标签 end
$arr['title'] = $titleSpan . $title;
//最后过滤
#$arr['title'] = strip_tags(str_replace('d class="embedded">',"",$arr['title'])); // 过滤
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

187
app/Protocols/pthome.php Normal file
View File

@ -0,0 +1,187 @@
<?php
/**
* www.pthome.net解码类
* 保留账号Veteran User、【6 TB】、必须注册至少40周并且下载至少1000G分享率大于6
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Pthome implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'pthome';
/**
* 域名
* @var string
*/
const domain = 'www.pthome.net';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding;
requests::$output_encoding = self::encoding;
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(正序算法)
// 偏移量
$h2_offset = strpos($v,'<br />') + strlen('<br />');
$h2_len = strpos($v,'</td><td width="20"',$h2_offset) - $h2_offset;
if($h2_len > 0){
//存在副标题
$arr['title'] = substr($v, $h2_offset, $h2_len);
//二次过滤
$arr['title'] = selector::remove($arr['title'], "//a");
}else{
$arr['title'] = '';
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

228
app/Protocols/ptmsg.php Normal file
View File

@ -0,0 +1,228 @@
<?php
/**
* pt.msg.vg解码类
*
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Ptmsg implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'ptmsg';
/**
* 域名
* @var string
*/
const domain = 'pt.msg.vg';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志 class="hitandrun" 或者 title="H&amp;R"
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
* Array
(
[id] => 118632
[h1] => CCTV5+ 2019 ATP Men's Tennis Final 20191115B HDTV 1080i H264-HDSTV
[title] => 央视体育赛事频道 2019年ATP男子网球年终总决赛 单打小组赛 纳达尔VS西西帕斯 20191115[优惠剩余时间4时13分]
[details] => https://hdsky.me/details.php?id=118632
[download] => https://hdsky.me/download.php?id=118632
[filename] => 118632.torrent
[type] => 0
[sticky] => 1
[time] => Array
(
[0] => "2019-11-16 20:41:53">4时13分
[1] => "2019-11-16 14:41:53">1时<br />46分
)
[comments] => 0
[size] => 5232.64MB
[seeders] => 69
[leechers] => 10
[completed] => 93
[percentage] => 100%
[owner] => 匿名
)
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '<br /></td><td width="20" class="embedded"';
$h2_offset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_offset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 第二次过滤
#code...
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// H&R检测
foreach ( self::$HR as $hrV ){
if(strpos($v,$hrV) != false){
self::$TorrentList[$k]['hr'] = 1;
// 删除
#unset( self::$TorrentList[$k] );
break;
}
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

198
app/Protocols/ptsbao.php Normal file
View File

@ -0,0 +1,198 @@
<?php
/**
* ptsbao.club解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Ptsbao implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'ptsbao';
/**
* 域名
* @var string
*/
const domain = 'ptsbao.club';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free','alt="Free"','alt="2X Free"');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '&'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="80" class="embedded"';
$h2_offset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_offset);
$h2_offset = strrpos($temp,$h2StrStart);
#p($temp);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
//二次过滤
$arr['title'] = str_replace('</span>',"",$arr['title']);
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

195
app/Protocols/site52pt.php Normal file
View File

@ -0,0 +1,195 @@
<?php
/**
* 52pt.site解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Site52pt implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = '52pt';
/**
* 域名
* @var string
*/
const domain = '52pt.site';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="20" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 第二次过滤
#code...
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

197
app/Protocols/soulvoice.php Normal file
View File

@ -0,0 +1,197 @@
<?php
/**
* soulvoice解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Soulvoice implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'soulvoice';
/**
* 域名
* @var string
*/
const domain = 'pt.soulvoice.club';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free','alt="Free"','alt="2X Free"');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="20" class="embedded"';
$h2_offset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_offset);
$h2_offset = strrpos($temp,$h2StrStart);
#p($temp);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
//二次过滤
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

187
app/Protocols/ssd.php Normal file
View File

@ -0,0 +1,187 @@
<?php
/**
* springsunday.net解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Ssd implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'ssd';
/**
* 域名
* @var string
*/
const domain = 'springsunday.net';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding;
requests::$output_encoding = self::encoding;
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(正序算法)
// 偏移量
$h2_offset = strpos($v,'<br />') + strlen('<br />');
$h2_len = strpos($v,'</td><td width="60" class="embedded"',$h2_offset) - $h2_offset;
if($h2_len > 0){
//存在副标题
$arr['title'] = substr($v, $h2_offset, $h2_len);
//二次过滤
$arr['title'] = selector::remove($arr['title'], "//a");
}else{
$arr['title'] = '';
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

194
app/Protocols/tjupt.php Normal file
View File

@ -0,0 +1,194 @@
<?php
/**
* tjupt.org解码类
* 威震一方及以上用户会永远保留账号。必须注册至少40周并且下载至少750G分享率大于3.05。[2.3TB保号]
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Tjupt implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'tjupt';
/**
* 域名
* @var string
*/
const domain = 'tjupt.org';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('免费</font>');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="40" class="embedded"';
$h2_offset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_offset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 第二次过滤
$arr['title'] = selector::remove($arr['title'], "//a");
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

View File

@ -0,0 +1,194 @@
<?php
/**
* et8.org解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Torrentccf implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'torrentccf';
/**
* 域名
* @var string
*/
const domain = 'et8.org';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$data = selector::select($html, "//*[@class='torrentname']");
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<a title="') + strlen('<a title="');
$h1_len = strpos($v, '" href="details.php?id=') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br />';
$h2StrEnd = '</td><td width="20" class="embedded"';
$h2_endOffset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_endOffset);
$h2_offset = strrpos($temp,$h2StrStart);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$arr['title'] = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
// 第二次过滤
#code...
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}

View File

@ -0,0 +1,190 @@
<?php
/**
* totheglory解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Totheglory implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'ttg';
/**
* 域名
* @var string
*/
const domain = 'totheglory.im';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'dl/';
/**
* 种子详情页前缀
*/
const detailsPrefix = 't/{}/';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('ico_free.gif');
/**
* H&R 标志
*/
public static $HR = array('hit_run.gif','title="Hit and Run"','title="Hit');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '/'.$config['passkey'] : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'browse.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$html = selector::select($html, "//*[@id='torrent_table']");
$data = selector::select($html, "//div[@class='name_left']");
#p($data);exit;
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
// 种子ID前缀
$torrentIdPrefix = 'torrent="';
$toorentIdStrLen = strlen($torrentIdPrefix);
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 种子id[单独截取]
$idOffset = $idTemp = '';
$idOffset = strpos($v,$torrentIdPrefix);
$idTemp =substr($v,$idOffset + $toorentIdStrLen,10);
$arr['id'] = substr($idTemp,0,strpos($idTemp,'"'));
// 种子地址
$arr['url'] = self::downloadPrefix . $arr['id'] . self::$passkey;
#p($arr);exit;
// 获取主标题
// 偏移量
$h1_offset = strpos($v, 'torrentname="') + strlen('torrentname="');
$h1_len = strpos($v, '" torrent="') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
if (strpos($arr['h1'],'&#x') != false) {
$arr['h1'] = mb_convert_encoding($arr['h1'], 'UTF-8', 'HTML-ENTITIES');
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.str_replace('{}',$arr['id'],self::detailsPrefix);
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// H&R检测
foreach ( self::$HR as $hrV ){
if(strpos($v,$hrV) != false){
self::$TorrentList[$k]['hr'] = 1;
// 删除
#unset( self::$TorrentList[$k] );
break;
}
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);exit;
return self::$TorrentList;
}
}

223
app/Protocols/yingk.php Normal file
View File

@ -0,0 +1,223 @@
<?php
/**
* yingk解码类
*
*/
use phpspider\core\requests;
use phpspider\core\selector;
class Yingk implements decodeBase
{
/**
* 站点标志
* @var string
*/
const SITE = 'yingk';
/**
* 域名
* @var string
*/
const domain = 'yingk.com';
const HOST = 'https://'.self::domain.'/';
// 下载种子的请求类型
const METHOD = 'GET';
/**
* 种子存放路径
* @var string
*/
const TORRENT_DIR = TORRENT_PATH . self::SITE . DS;
/**
* 种子下载前缀
*/
const downloadPrefix = 'download.php?id=';
/**
* 种子详情页前缀
*/
const detailsPrefix = 'details.php?id=';
// 网页编码
const encoding = 'UTF-8';
// 超时时间
const CONNECTTIMEOUT = 30;
const TIMEOUT = 600;
/**
* cookie
*/
public static $cookies = '';
/**
* 浏览器 User-Agent
*/
public static $userAgent = '';
/**
* passkey
*/
public static $passkey = '';
/**
* 获取的种子标志
*/
public static $getTorrent = array('class="pro_free');
/**
* H&R 标志
*/
public static $HR = array('class="hitandrun"','alt="H&amp;R"','title="H&amp;R"');
/**
* 解码后种子列表数组
*/
public static $TorrentList = array();
/**
* 初始化配置
*/
public static function init(){
global $configALL;
$config = $configALL[self::SITE];
self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$passkey = isset($config['passkey']) ? '&passkey='.$config['passkey'].'&https=1' : '';
requests::$input_encoding = self::encoding; //输入的网页编码
requests::$output_encoding = self::encoding; //输出的网页编码
requests::set_cookies(self::$cookies, self::domain);
requests::set_useragent([self::$userAgent]);
requests::set_timeout([self::CONNECTTIMEOUT,self::TIMEOUT]);
}
/**
* 执行
*
* @param string
* @return array
*/
public static function run()
{
self::init();
Rpc::init(self::SITE, self::METHOD);
$html = self::get();
if ( $html === null ) {
exit(1);
}
$data = self::decode($html);
#p($data);exit;
Rpc::call($data);
exit(0);
}
/**
* 请求页面
*
* @param string $url
* @return array
*/
public static function get($url = 'torrents.php')
{
// 发起请求
$html = requests::get(self::HOST.$url);
// 获取列表页数据
$html = selector::select($html, "//*[@class='torrents']");
#p($html);exit;
$data = selector::select($html, "//table");
#p($data);exit;
if(!$data){
echo "登录信息过期,请重新设置! \n";
return null;
}
return $data;
}
/**
* 解码
*
* @param array $data
* @return array
*/
public static function decode($data = array())
{
$downloadStrLen = strlen(self::downloadPrefix); // 前缀长度
$downloadStrEnd = '"'; //种子地址结束标志
$len = $downloadStrLen + 10; // 截取长度
foreach ( $data as $k => $v ){
$arr = array();
// 种子基本信息处理
// 偏移量
$offset = strpos($v,self::downloadPrefix);
// 截取
$urlTemp = substr($v,$offset,$len);
// 种子地址
$arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd));
// 种子id
$arr['id'] = substr($arr['url'],$downloadStrLen);
// 获取主标题
// 偏移量
$h1_offset = strpos($v, '<b>') + strlen('<b>');
$h1_len = strpos($v, '</b>') - $h1_offset;
$arr['h1'] = substr($v, $h1_offset, $h1_len);
if (strpos($arr['h1'],'&#x') != false) {
$arr['h1'] = mb_convert_encoding($arr['h1'], 'UTF-8', 'HTML-ENTITIES');
}
// 获取副标题(倒序算法)
// 偏移量
$h2StrStart = '<br/>';
$h2StrEnd = '</td><td rowspan="2" width="20"';
$h2_offset = strpos($v,$h2StrEnd);
$temp = substr($v, 0, $h2_offset);
$h2_offset = strrpos($temp,$h2StrStart);
#p($temp);
if ($h2_offset === false ) {
$arr['title'] = '';
} else {
$h2_len = strlen($temp) - $h2_offset - strlen($h2StrStart);
//存在副标题
$titleTemp = substr($temp, $h2_offset + strlen($h2StrStart), $h2_len);
#p($titleTemp);
//二次过滤
$title = selector::remove($titleTemp, "//b");
$title = selector::remove($title, "//span");
// 精确适配标签 begin
$titleSpan = '';
$span = selector::select($titleTemp, '//span');
if(!empty($span)){
if(is_array($span)){
foreach ( $span as $vv ){
if( empty($vv) ){
continue;
}
if ( strpos($vv,"</span>") != false ) {
continue;
}
$titleSpan.='['.$vv.'] ';
}
}else{
$titleSpan.='['.$span.'] ';
}
}
// 精确适配标签 end
$arr['title'] = $titleSpan . $title;
}
// 组合返回数组
self::$TorrentList[$k]['id'] = $arr['id'];
self::$TorrentList[$k]['h1'] = $arr['h1'];
self::$TorrentList[$k]['title'] = isset( $arr['title'] ) && $arr['title'] ? $arr['title'] : '';
self::$TorrentList[$k]['details'] = self::HOST.self::detailsPrefix.$arr['id'];
self::$TorrentList[$k]['download'] = self::HOST.$arr['url'];
self::$TorrentList[$k]['filename'] = $arr['id'].'.torrent';
// 种子促销类型解码
if(strpos($v,self::$getTorrent[0]) === false){
// 不免费
self::$TorrentList[$k]['type'] = 1;
}else{
// 免费种子
self::$TorrentList[$k]['type'] = 0;
}
// 存活时间
// 大小
// 种子数
// 下载数
// 完成数
// 完成进度
}
#p(self::$TorrentList);
return self::$TorrentList;
}
}