From cf8ee2ab735e1d7dffaebef470e84ae6266ecea7 Mon Sep 17 00:00:00 2001 From: "iyuu.cn" <367013672@qq.com> Date: Tue, 24 Dec 2019 11:08:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Ehdstreet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Class/Oauth.php | 9 +- app/Protocols/hdstreet.php | 206 +++++++++++++++++++++++++++++++++++ app/Protocols/moecat.php | 4 +- app/config/config.sample.php | 7 ++ app/config/version.php | 2 +- app/hdstreet.php | 3 + iyuu.cn.php | 16 ++- readme.md | 6 +- wiki/更新历史.md | 6 +- 9 files changed, 248 insertions(+), 11 deletions(-) create mode 100644 app/Protocols/hdstreet.php create mode 100644 app/hdstreet.php diff --git a/app/Class/Oauth.php b/app/Class/Oauth.php index 19e964d..9176295 100644 --- a/app/Class/Oauth.php +++ b/app/Class/Oauth.php @@ -27,7 +27,7 @@ class Oauth{ } } echo "-----缺少用户登录参数:token, user_id, passkey, site \n"; - echo "-----当前正在使用测试接口,功能会受到限制! \n\n"; + echo "-----当前正在使用测试接口,功能可能会受到限制! \n\n"; return false; } /** @@ -37,7 +37,12 @@ class Oauth{ global $configALL; // 爱语飞飞 $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; return $token; } diff --git a/app/Protocols/hdstreet.php b/app/Protocols/hdstreet.php new file mode 100644 index 0000000..3c7489d --- /dev/null +++ b/app/Protocols/hdstreet.php @@ -0,0 +1,206 @@ +'); + $offsetEnd = strpos($html,'target="_self" title="查看两倍上传量种子"> $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, '') != false ) { + $arr['title'] = str_replace(' '', ), + // hdstreet 序号:34 + 'hdstreet' => array( + // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) + 'cookie' => '', + // 如果需要自动辅种,必须配置 + 'passkey' => '', + ), // 配置文件结束 ); \ No newline at end of file diff --git a/app/config/version.php b/app/config/version.php index dfa8c67..903caa7 100644 --- a/app/config/version.php +++ b/app/config/version.php @@ -1 +1 @@ - $v) { $reseed = $infohash_Dir = array(); if (empty($resArray['clients_'.$k])) { echo "clients_".$k."没有查询到可辅种数据 \n\n"; continue; } + // 当前客户端辅种数据 $reseed = $resArray['clients_'.$k]; // info_hash 对应的下载目录 $infohash_Dir = self::$links[$k]['hash']; foreach ($reseed as $info_hash => $vv) { + // 当前种子哈希对应的目录 $downloadDir = $infohash_Dir[$info_hash]; foreach ($vv['torrent'] as $id => $value) { $sitesID = $value['sid']; $url = $_url = ''; $download_page = ''; + // 页面规则 $download_page = str_replace('{}', $value['torrent_id'], $sites[$sitesID]['download_page']); $_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$download_page; if (empty($configALL[$sites[$sitesID]['site']]['passkey'])) { @@ -340,24 +344,25 @@ class iyuuAutoReseed break; } // 检查不辅种的站点 - // 判断是否VIP/特殊权限? + // 判断是否VIP或特殊权限? $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 ( isset($infohash_Dir[$value['info_hash']]) ) { // 与客户端现有种子重复 echo '-------与客户端现有种子重复:'.$_url."\n\n"; + continue; }else{ // 判断上次是否成功添加? if ( is_file(self::$cacheHash . $value['info_hash'].'.txt') ) { echo '-------当前种子上次辅种已成功添加,已跳过!'.$_url."\n\n"; continue; } - // 把拼接的种子URL,推送给下载器 - $ret = false; + $ret = false; + // 成功返回:true $ret = self::add($k, $url, $downloadDir); - // 写日志 + // 添加成功的种子,以infohash为文件名,写入缓存 if ($ret) { // 文件句柄 $resource = fopen(self::$cacheHash . $value['info_hash'].'.txt', "wb"); @@ -382,6 +387,9 @@ class iyuuAutoReseed } } } + /** + * 正常做种的种子在各下载器的互相转移 + */ public static function move($torrent=array(), $type = 'qBittorrent'){ switch($type){ case 'transmission': diff --git a/readme.md b/readme.md index afdee17..77c5a46 100644 --- a/readme.md +++ b/readme.md @@ -16,10 +16,14 @@ IYUU自动辅种工具(英文名:iyuuAutoReseed),是一款PHP语言编 1. transmission 2. qBittorrent +## 支持自动辅种的站点 +学校、杜比、家园、天空、朋友、馒头、萌猫、我堡、猫站、铂金家、烧包、北洋、TCCF、南洋、TTG、映客、城市、52pt、brobits、备胎、SSD、CHD、ptmsg、leaguehd、聆音、瓷器、hdarea、eastgame(TLF)、1ptba、hdtime、hd4fans、opencd、hdbug、hdstreet。 + ## 运行环境 所有具备PHP运行环境的所有平台! 例如: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 diff --git a/wiki/更新历史.md b/wiki/更新历史.md index 1fff2d7..b46b29c 100644 --- a/wiki/更新历史.md +++ b/wiki/更新历史.md @@ -1,3 +1,8 @@ +### 2019年12月24日 +新增hdstreet + +------ + ### 2019年12月23日 鉴权模式上线试运行 @@ -6,7 +11,6 @@ ### 2019年12月21日 新增兽站、opencd、hdbug; -自动辅种33个站:学校、杜比、家园、天空、朋友、馒头、萌猫、我堡、猫站、铂金家、烧包、北洋、TCCF、南洋、TTG、映客、城市、52pt、brobits、备胎、SSD、CHD、ptmsg、leaguehd、聆音、瓷器、hdarea、eastgame、1ptba、hdtime、hd4fans、opencd、hdbug。 ------