mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-05-20 00:15:23 +00:00
新增hdstreet
This commit is contained in:
parent
10a3b4b875
commit
cf8ee2ab73
@ -27,7 +27,7 @@ class Oauth{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "-----缺少用户登录参数:token, user_id, passkey, site \n";
|
echo "-----缺少用户登录参数:token, user_id, passkey, site \n";
|
||||||
echo "-----当前正在使用测试接口,功能会受到限制! \n\n";
|
echo "-----当前正在使用测试接口,功能可能会受到限制! \n\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -37,7 +37,12 @@ class Oauth{
|
|||||||
global $configALL;
|
global $configALL;
|
||||||
// 爱语飞飞
|
// 爱语飞飞
|
||||||
$token = isset($configALL['iyuu.cn']) && $configALL['iyuu.cn'] ? $configALL['iyuu.cn'] : '';
|
$token = isset($configALL['iyuu.cn']) && $configALL['iyuu.cn'] ? $configALL['iyuu.cn'] : '';
|
||||||
// 鉴权
|
if (empty($token) || strlen($token)<46) {
|
||||||
|
echo "缺少辅种接口请求参数:爱语飞飞token \n";
|
||||||
|
echo "请访问https://iyuu.cn 用微信扫码申请,并填入配置文件config.php内。\n\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
// 发布员鉴权
|
||||||
#$token = isset($configALL['secret']) && $configALL['secret'] ? $configALL['secret'] : $token;
|
#$token = isset($configALL['secret']) && $configALL['secret'] ? $configALL['secret'] : $token;
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
|
206
app/Protocols/hdstreet.php
Normal file
206
app/Protocols/hdstreet.php
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* hdstreet解码类
|
||||||
|
*/
|
||||||
|
use phpspider\core\requests;
|
||||||
|
use phpspider\core\selector;
|
||||||
|
|
||||||
|
class hdstreet implements decodeBase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 站点标志
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
const SITE = 'hdstreet';
|
||||||
|
/**
|
||||||
|
* 域名
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
const domain = 'hdstreet.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&R"','title="H&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);
|
||||||
|
#p($html);exit;
|
||||||
|
$offset = strpos($html,'<img class="size" src="pic/trans.gif" alt="size" title="大小" /></a></td>');
|
||||||
|
$offsetEnd = strpos($html,'target="_self" title="查看两倍上传量种子"><font class=');
|
||||||
|
$html = substr($html,$offset,$offsetEnd);
|
||||||
|
// 获取列表页数据
|
||||||
|
$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_temp = substr($v, $h1_offset);
|
||||||
|
$h1_len = strpos($h1_temp, '"');
|
||||||
|
$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';
|
||||||
|
$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'] = selector::remove($arr['title'], "//div");
|
||||||
|
// 第二次过滤
|
||||||
|
if ( strpos($arr['title'],'</td>') != false ) {
|
||||||
|
$arr['title'] = str_replace('</td><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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* moecat.best解码类
|
* moecat.best解码类
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
use phpspider\core\requests;
|
use phpspider\core\requests;
|
||||||
use phpspider\core\selector;
|
use phpspider\core\selector;
|
||||||
@ -189,7 +189,7 @@ class Moecat implements decodeBase
|
|||||||
}
|
}
|
||||||
$titleSpan.='['.$vv.'] ';
|
$titleSpan.='['.$vv.'] ';
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$titleSpan.='['.$span.'] ';
|
$titleSpan.='['.$span.'] ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,6 +349,13 @@ return array(
|
|||||||
// 如果需要自动辅种,必须配置
|
// 如果需要自动辅种,必须配置
|
||||||
'passkey' => '',
|
'passkey' => '',
|
||||||
),
|
),
|
||||||
|
// hdstreet 序号:34
|
||||||
|
'hdstreet' => array(
|
||||||
|
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||||
|
'cookie' => '',
|
||||||
|
// 如果需要自动辅种,必须配置
|
||||||
|
'passkey' => '',
|
||||||
|
),
|
||||||
|
|
||||||
// 配置文件结束
|
// 配置文件结束
|
||||||
);
|
);
|
@ -1 +1 @@
|
|||||||
<?php return '20191221.1920';
|
<?php return '20191224.1010';
|
||||||
|
3
app/hdstreet.php
Normal file
3
app/hdstreet.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/init.php';
|
||||||
|
hdstreet::run();
|
16
iyuu.cn.php
16
iyuu.cn.php
@ -304,21 +304,25 @@ class iyuuAutoReseed
|
|||||||
// 可辅种站点信息列表
|
// 可辅种站点信息列表
|
||||||
$sites = $resArray['sites'];
|
$sites = $resArray['sites'];
|
||||||
#p($sites);
|
#p($sites);
|
||||||
|
// 按客户端循环辅种
|
||||||
foreach (self::$links as $k => $v) {
|
foreach (self::$links as $k => $v) {
|
||||||
$reseed = $infohash_Dir = array();
|
$reseed = $infohash_Dir = array();
|
||||||
if (empty($resArray['clients_'.$k])) {
|
if (empty($resArray['clients_'.$k])) {
|
||||||
echo "clients_".$k."没有查询到可辅种数据 \n\n";
|
echo "clients_".$k."没有查询到可辅种数据 \n\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// 当前客户端辅种数据
|
||||||
$reseed = $resArray['clients_'.$k];
|
$reseed = $resArray['clients_'.$k];
|
||||||
// info_hash 对应的下载目录
|
// info_hash 对应的下载目录
|
||||||
$infohash_Dir = self::$links[$k]['hash'];
|
$infohash_Dir = self::$links[$k]['hash'];
|
||||||
foreach ($reseed as $info_hash => $vv) {
|
foreach ($reseed as $info_hash => $vv) {
|
||||||
|
// 当前种子哈希对应的目录
|
||||||
$downloadDir = $infohash_Dir[$info_hash];
|
$downloadDir = $infohash_Dir[$info_hash];
|
||||||
foreach ($vv['torrent'] as $id => $value) {
|
foreach ($vv['torrent'] as $id => $value) {
|
||||||
$sitesID = $value['sid'];
|
$sitesID = $value['sid'];
|
||||||
$url = $_url = '';
|
$url = $_url = '';
|
||||||
$download_page = '';
|
$download_page = '';
|
||||||
|
// 页面规则
|
||||||
$download_page = str_replace('{}', $value['torrent_id'], $sites[$sitesID]['download_page']);
|
$download_page = str_replace('{}', $value['torrent_id'], $sites[$sitesID]['download_page']);
|
||||||
$_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$download_page;
|
$_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$download_page;
|
||||||
if (empty($configALL[$sites[$sitesID]['site']]['passkey'])) {
|
if (empty($configALL[$sites[$sitesID]['site']]['passkey'])) {
|
||||||
@ -340,24 +344,25 @@ class iyuuAutoReseed
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 检查不辅种的站点
|
// 检查不辅种的站点
|
||||||
// 判断是否VIP/特殊权限?
|
// 判断是否VIP或特殊权限?
|
||||||
$is_vip = isset($configALL[$sites[$sitesID]['site']]['is_vip']) && $configALL[$sites[$sitesID]['site']]['is_vip'] ? 1 : 0;
|
$is_vip = isset($configALL[$sites[$sitesID]['site']]['is_vip']) && $configALL[$sites[$sitesID]['site']]['is_vip'] ? 1 : 0;
|
||||||
if ( (in_array($sites[$sitesID]['site'], self::$noReseed)==false) || $is_vip ) {
|
if ( (in_array($sites[$sitesID]['site'], self::$noReseed)==false) || $is_vip ) {
|
||||||
// 可以辅种
|
// 可以辅种
|
||||||
if ( isset($infohash_Dir[$value['info_hash']]) ) {
|
if ( isset($infohash_Dir[$value['info_hash']]) ) {
|
||||||
// 与客户端现有种子重复
|
// 与客户端现有种子重复
|
||||||
echo '-------与客户端现有种子重复:'.$_url."\n\n";
|
echo '-------与客户端现有种子重复:'.$_url."\n\n";
|
||||||
|
continue;
|
||||||
}else{
|
}else{
|
||||||
// 判断上次是否成功添加?
|
// 判断上次是否成功添加?
|
||||||
if ( is_file(self::$cacheHash . $value['info_hash'].'.txt') ) {
|
if ( is_file(self::$cacheHash . $value['info_hash'].'.txt') ) {
|
||||||
echo '-------当前种子上次辅种已成功添加,已跳过!'.$_url."\n\n";
|
echo '-------当前种子上次辅种已成功添加,已跳过!'.$_url."\n\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 把拼接的种子URL,推送给下载器
|
// 把拼接的种子URL,推送给下载器
|
||||||
$ret = false;
|
$ret = false;
|
||||||
|
// 成功返回:true
|
||||||
$ret = self::add($k, $url, $downloadDir);
|
$ret = self::add($k, $url, $downloadDir);
|
||||||
// 写日志
|
// 添加成功的种子,以infohash为文件名,写入缓存
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
// 文件句柄
|
// 文件句柄
|
||||||
$resource = fopen(self::$cacheHash . $value['info_hash'].'.txt', "wb");
|
$resource = fopen(self::$cacheHash . $value['info_hash'].'.txt', "wb");
|
||||||
@ -382,6 +387,9 @@ class iyuuAutoReseed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 正常做种的种子在各下载器的互相转移
|
||||||
|
*/
|
||||||
public static function move($torrent=array(), $type = 'qBittorrent'){
|
public static function move($torrent=array(), $type = 'qBittorrent'){
|
||||||
switch($type){
|
switch($type){
|
||||||
case 'transmission':
|
case 'transmission':
|
||||||
|
@ -16,10 +16,14 @@ IYUU自动辅种工具(英文名:iyuuAutoReseed),是一款PHP语言编
|
|||||||
1. transmission
|
1. transmission
|
||||||
2. qBittorrent
|
2. qBittorrent
|
||||||
|
|
||||||
|
## 支持自动辅种的站点
|
||||||
|
学校、杜比、家园、天空、朋友、馒头、萌猫、我堡、猫站、铂金家、烧包、北洋、TCCF、南洋、TTG、映客、城市、52pt、brobits、备胎、SSD、CHD、ptmsg、leaguehd、聆音、瓷器、hdarea、eastgame(TLF)、1ptba、hdtime、hd4fans、opencd、hdbug、hdstreet。
|
||||||
|
|
||||||
## 运行环境
|
## 运行环境
|
||||||
所有具备PHP运行环境的所有平台!
|
所有具备PHP运行环境的所有平台!
|
||||||
例如:Linux、Windows、MacOS
|
例如:Linux、Windows、MacOS
|
||||||
1. Windows下安装php环境:https://www.php.net/downloads,官方下载的记得开启crul、fileinfo、mbstring,这3个扩展。
|
1. Windows下安装php环境:https://www.php.net/downloads
|
||||||
|
官方下载的记得开启crul、fileinfo、mbstring,这3个扩展。
|
||||||
|
|
||||||
## 下载源码
|
## 下载源码
|
||||||
- 码云仓库:https://gitee.com/ledc/IYUUAutoReseed
|
- 码云仓库:https://gitee.com/ledc/IYUUAutoReseed
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
### 2019年12月24日
|
||||||
|
新增hdstreet
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
### 2019年12月23日
|
### 2019年12月23日
|
||||||
鉴权模式上线试运行
|
鉴权模式上线试运行
|
||||||
|
|
||||||
@ -6,7 +11,6 @@
|
|||||||
### 2019年12月21日
|
### 2019年12月21日
|
||||||
|
|
||||||
新增兽站、opencd、hdbug;
|
新增兽站、opencd、hdbug;
|
||||||
自动辅种33个站:学校、杜比、家园、天空、朋友、馒头、萌猫、我堡、猫站、铂金家、烧包、北洋、TCCF、南洋、TTG、映客、城市、52pt、brobits、备胎、SSD、CHD、ptmsg、leaguehd、聆音、瓷器、hdarea、eastgame、1ptba、hdtime、hd4fans、opencd、hdbug。
|
|
||||||
|
|
||||||
------
|
------
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user