$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, '',$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, '@', "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年
2月 ) string "2016-04-24 15:43:25">3年
7月 */ $options = selector::select($v, "//*[@class='rowfollow']"); unset($options[0]); $options = array_values($options); #p($options);exit; /* $options = Array ( [0] =>
0 [1] => 50.11
GB [2] => 70 [3] => 24 [4] => 95 [5] => 匿名 ) 对应的: [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('
','',$options[1]); // 2 种子数seeders if ( empty($options[2]) ) { $seeders = 0; } else { if( strpos($options[2],'') === false ){ if ( strpos($options[2],'
') === 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; } }