多乐音乐电台 - 1ting音乐全站代理

  • 内容
  • 相关
<?php /** 多乐电台 PHP代理程序 * 鬼少(594483473)编写 * 请保留版权信息 * 此源码仅供交流使用,不得用于商业用途,否则后果自负。 */ header("Content-type:text/html;charset=UTF-8"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-store, must-revalidate"); header("Pragma: no-cache"); $url = $_SERVER["HTTP_REFERER"]; $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<list datatime=\"".date("Y-m-d H:i:s")."\" data_info=\"\">\n"; $fname ='http://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $allfname ='http://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"];//$_SERVER["SCRIPT_NAME"]; $pagesize = "20"; //歌手分类生成 if(isset ($_GET['all_singer'])){ global $fname; $cate = array("id"=>array("","1","2","3","14","15","16","4","5","6","7"),"name"=>array("所有歌手","华语男歌手","华语女歌手","华语组合","欧美男歌手","欧美女歌手","欧美组合","日本歌手","韩国歌手","影视歌曲","其他歌曲")); for($i=0;$i<count($cate[id]);$i++){ $xml.='<m list_src="'.$fname.'?cate='.$cate[id][$i].'" label="'.$cate[name][$i].'" />'."\n"; } } //分类歌手获取 elseif(isset ($_GET['cate'])){ global $fname; $pagesize=20; $page=isset($_GET['page'])?$_GET['page']:1; $ss= 'http://www.duole.com/api/song/get_singer_list?page='.$page.'&cate='.$_GET['cate'].'&limit='.$pagesize.'&context=1'; $st = J_encode(g_contents($ss)); preg_match_all('|"singer_id":"(.*?)","|',$st, $singerId); preg_match_all('|"singer_name":"(.*?)","|',$st, $singerName); preg_match_all('|"logo":"(.*?)"|',$st, $singerPic); preg_match_all('|"total":"(.*?)"}|',$st, $total); $singerId=$singerId[1];$singerName=$singerName[1];$singerPic=$singerPic[1];$total=$total[1][0]; foreach ($singerId as $k => $v){ $xml.='<m list_src="'.$fname.'?singerid='.$v.'" label="'.$singerName[$k].'" />'."\n"; } if($page=='1'){ $pagenum=ceil($total/$pagesize); for($i=2;$i<$pagenum;$i++){ $xml.='<m list_src="'.$fname.'?cate='.$_GET['cate'].'&page='.$i.'" label="第'.$i.'页" />'."\n"; } } } //歌手搜索 elseif(isset ($_GET['singerso'])){ global $fname; $pagesize=20; $page=isset($_GET['page'])?$_GET['page']:1; $ss= 'http://www.duole.com/api/song/get_singer_list?page='.$page.'&singer_name='.$_GET['singerso'].'&limit='.$pagesize.'&context=1'; $st = J_encode(g_contents($ss)); preg_match_all('|"singer_id":"(.*?)","|',$st, $singerId); preg_match_all('|"singer_name":"(.*?)","|',$st, $singerName); preg_match_all('|"logo":"(.*?)"|',$st, $singerPic); preg_match_all('|"total":"(.*?)"}|',$st, $total); $singerId=$singerId[1];$singerName=$singerName[1];$singerPic=$singerPic[1];$total=$total[1][0]; foreach ($singerId as $k => $v){ $xml.='<m list_src="'.$fname.'?singerid='.$v.'" label="'.$singerName[$k].'" />'."\n"; } if($page=='1'){ $pagenum=ceil($total/$pagesize); for($i=2;$i<$pagenum;$i++){ $xml.='<m list_src="'.$fname.'?singerso='.$_GET['singerso'].'&page='.$i.'" label="第'.$i.'页" />'."\n"; } } } //歌手音乐单获取 elseif(isset($_GET['singerid'])){ global $fname; $ss= 'http://www.duole.com/api/song/get_singer_play_list?singer_id='.$_GET['singerid'].'&limit=100&context=2'; $st = J_encode(g_contents($ss)); preg_match_all('|"resource_id":"(.*?)",|',$st, $arr); preg_match_all('|"song_name":"(.*?)"|',$st, $name); preg_match_all('|"singer_name":"(.*?)"|',$st, $singer); preg_match_all('|"song_file":"(.*?)"|',$st, $src); preg_match_all('|"album_logo_400":"(.*?)"|',$st, $img); preg_match_all('|"lrc":"(.*?)"|',$st, $lrc); $ids=$arr[1];$name=$name[1];$singer=$singer[1];$src=$src[1];$img=$img[1];$lrc=$lrc[1]; foreach ($ids as $k => $v){ $xml.='<m type="1" src="'.$src[$k].'" label="'.$name[$k].' - '.$singer[$k].'" id="'.$v.'" bg_video="{src:'.$img[$k].',xywh:[0,0,100%,100%]}"/>'."\n"; //lrc="'.$lrc[$k].'" } } //歌手图片代理 elseif(isset ($_GET['img'])){ $name = urlencode($_GET['img']); global $fname; $ss= 'http://lp.music.ttpod.com/pic/down?artist='.$name.'&rand={rand}code={code}x={x}y={y}'; $st = g_contents($ss); preg_match_all('|singerPic":"(.*)"|',$st, $arr); $ids=$arr[1][0]; $data = g_contents($ids); header("content-type:image/jpeg"); echo $data; } //风格音乐单获取 elseif(isset($_GET['list_id']) && isset($_GET['mood'])){ global $fname; $ss= 'http://www.duole.com/api/song/get_song_play_list?scene_id='.$_GET['list_id'].'&limit='.$pagesize.'&mood_id='.$_GET['mood'].'&gender=0&lang=0&context=1'; $st = J_encode(g_contents($ss)); preg_match_all('|"resource_id":"(.*?)",|',$st, $arr); preg_match_all('|"song_name":"(.*?)"|',$st, $name); preg_match_all('|"singer_name":"(.*?)"|',$st, $singer); preg_match_all('|"song_file":"(.*?)"|',$st, $src); preg_match_all('|"album_logo_400":"(.*?)"|',$st, $img); preg_match_all('|"lrc":"(.*?)"|',$st, $lrc); $ids=$arr[1];$name=$name[1];$singer=$singer[1];$src=$src[1];$img=$img[1];$lrc=$lrc[1]; foreach ($ids as $k => $v){ $xml.='<m type="1" src="'.$src[$k].'" label="'.$name[$k].' - '.$singer[$k].'" id="'.$v.'" bg_video="{src:'.$img[$k].',xywh:[0,0,100%,100%]}"/>'."\n"; } } //默认输出风格分类 else{ global $fname; $mood = array("id"=>array("6","1","2","3","4","5","7","8","9"),"name"=>array("无","愤怒","痛苦","烦躁","伤感","寂寞","轻松","温暖","快乐")); $ss= 'http://www.duole.com/api/scene/get_all?limit=21'; $st = J_encode(g_contents($ss)); preg_match_all('|"id":"(.*?)",|',$st, $arr); preg_match_all('|"scene_name":"(.*?)"|',$st, $name); $ids=$arr[1]; $title=$name[1]; foreach ($ids as $k => $v){ $xml.='<m label="'.$title[$k].'">'."\n"; for($i=0;$i<count($mood[id]);$i++){ $xml.='<m list_src="'.$fname.'?list_id='.$v.'&mood='.$mood[id][$i].'" label="'.$mood[name][$i].'" />'."\n"; } $xml.='</m>'."\n"; } } $xml .= '</list>'; echo $xml; /** 自定义函数类 **/ function g_contents($url) { $user_agent = $_SERVER['HTTP_USER_AGENT']; $ch = curl_init(); //$user = "http://fm.dongting.com/"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 3); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); @ $data = curl_exec($ch); curl_close($ch); return $data; } function object_array($array){ if(is_object($array)){ $array = (array)$array; } if(is_array($array)){ foreach($array as $key=>$value){ $array[$key] = object_array($value); } } return $array; } function J_encode($arr){ $search = "#\\\u([0-9a-f]+)#ie"; $replace = "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))"; $str = preg_replace($search, $replace, $arr); return str_replace("\\","", $str); } ?>

本文标签:

版权声明:若无特殊注明,本文皆为《鬼少》原创,转载请保留文章出处。

本文链接:多乐音乐电台 - 1ting音乐全站代理 - http://tv1314.com/post-84.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注

评论

4条评论
  1. avatar

    淘宝客招募 Lv.1 Chrome 45.0.2454.101 Chrome 45.0.2454.101 Windows 7 Windows 7 回复


    你网站首页非常漂亮,非常喜欢,现在可以交换链接吗?我的网站

    广西百色市 电信

    00:00 / 00:00
    顺序播放