$v ){ $arr = array(); $urlTemp = ''; // 种子基本信息处理 // 提取种子id $idPrefix = 'href="t-'; $offset = strpos($v,$idPrefix) + strlen($idPrefix); // 截取 $urlTemp = substr($v, $offset, 13); // 种子id $arr['id'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd)); // 提取种子下载地址 $offset = strpos($v,self::downloadPrefix); // 截取 $urlTemp = substr($v,$offset,$len); // 种子地址 $arr['url'] = substr($urlTemp,0,strpos($urlTemp,$downloadStrEnd)); // 种子地址过滤 $arr['url'] = str_replace("&","&",$arr['url']); // 获取主标题 // 偏移量 $aTemp = selector::select($v, '//a'); $arr['h1'] = $aTemp[0]; // 主标题过滤:加粗 if (strpos($arr['h1'],'') != false) { $arr['h1'] = selector::select($v, '//strong'); #$arr['h1'] = selector::select($v, '@(.*?)@', "regex"); } // 主标题二次过滤:制作组 if (strpos($arr['h1'],'') != false) { $arr['h1'] = selector::remove($arr['h1'], '//span'); } // 获取副标题 // 偏移量 $arr['title'] = selector::select($v, "//div[@class='trbi']/a"); if(strpos($arr['title'],'') != false){ $arr['title'] = selector::select($arr['title'], '//span'); } $ploto = selector::select($v, "//div[@class='ploto']"); if ( strpos($ploto,'') != false ) { // 副标题二次过滤:码率 $ploto = selector::remove($ploto, "//a"); } $arr['title'] = $ploto ? $arr['title'] .' '. $ploto : $arr['title']; #p($arr);exit; // 组合返回数组 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; } }