Esempio n. 1
0
 public function get_children_category_album_list($term_taxonomy_id = 0, $page = 1)
 {
     $r = array();
     $url = "http://m.idaddy.cn/m.php?etr=spadmin&mod=freeAudio&do=list&term_taxonomy_id={$term_taxonomy_id}&cat_id=0&keyword=&spId=0&page={$page}&rand=" . mt_rand(100, 400);
     if (!$term_taxonomy_id) {
         return array();
     }
     if ($page == 1) {
         $content = parent::get($url);
         preg_match_all('/<ul [\\s|\\S]*?<\\/ul>/', $content, $result);
         $r = array();
         if (!isset($result[0][0])) {
             return array();
         }
         if (!$result[0][0]) {
             return array();
         }
         if (!strstr($result[0][0], 'list')) {
             return array();
         }
         $ul_content = $result[0][0];
     } else {
         $content = http::ajax_get($url);
         $content = json_decode($content, true);
         if ($content['recode'] != 1) {
             return array();
         }
         $ul_content = $content['context'];
     }
     preg_match_all('/<a [\\s|\\S]*?<\\/a>/', $ul_content, $result);
     foreach ($result[0] as $k => $v) {
         $url = http::sub_data($v, 'href="', '"');
         if (!strstr($url, 'http')) {
             $url = 'http://m.idaddy.cn' . $url;
         }
         $cover = http::sub_data($v, 'src="', '"');
         $title = http::sub_data($v, '<strong>', '</strong>');
         if ($title && $url) {
             $r[$k]['url'] = $url;
             $r[$k]['title'] = $title;
             $r[$k]['cover'] = $cover;
             $r[$k]['min_age'] = 0;
             $r[$k]['max_age'] = 0;
             if (strstr($v, 'P')) {
                 $r[$k]['min_age'] = (int) http::sub_data($v, 'P-', '<');
             } else {
                 $age = (int) http::sub_data($v, '<td style=" padding:0 0 0 10px;">', '<');
                 if (strstr($age, '-')) {
                     $tmp = explode("-", $age);
                     if (isset($tmp[1])) {
                         $r[$k]['max_age'] = $tmp[1];
                     }
                     if (isset($tmp[0])) {
                         $r[$k]['min_age'] = $tmp[0];
                     }
                 }
                 $r[$k]['age'] = (int) http::sub_data($v, '<td style=" padding:0 0 0 10px;">', '<');
             }
         }
     }
     return $r;
 }