zl程序教程

您现在的位置是:首页 >  后端

当前栏目

新浪乐库php解析源码

PHP源码 解析 新浪
2023-06-13 09:11:05 时间

新浪乐库php解析源码

作者:matrix 被围观: 1,866 次 发布时间:2013-10-26 分类:零零星星 | 5 条评论 »

这是一个创建于 3231 天前的主题,其中的信息可能已经有所发展或是发生改变。

demo:http://link.hhtjim.com

外链测试:

http://music.sina.com.cn/yueku/i/2850351.html

代码:

function vita_get_url_content($url) {  
$ch = curl_init();  
$timeout = 5;  
curl_setopt ($ch, CURLOPT_URL, $url);  
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);  
 curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);  
$file_contents = curl_exec($ch);  
curl_close($ch);  
return $file_contents;  
}  
error_reporting(0);  
$m=$_GET['id'];  
if ($m){  
$url="http://music.sina.com.cn/yueku/intro/musina_mpw_playlist.php?id[]=".$m;  
$file=vita_get_url_content($url);  
$regx='|MP3_URL":"(.*)",|'; 
preg_match($regx,$file,$rg); 
$url = str_replace("\\","",$rg[1]); 
$file=vita_get_url_content($url); 
$regx='|="(.*)"|'; 
preg_match($regx,$file,$rg); 
} else { 
exit('not found ID'); 
} 
Header("HTTP/1.1 303 See Other"); 
header("location: $rg[1]");  

说明:保存为*.php

打开http://serve/*.php?id=2850351   即下载

根据音乐ID来找真实地址 http://music.sina.com.cn/yueku/intro/musina_mpw_playlist.php?id[]=2850351

代码来自:http://zhidao.baidu.com/question/160385986.html


新浪视频外链接口

http://v.iask.com/v_play.php?vid=视频ID

如:http://video.sina.com.cn/v/b/10855159-1400488700.html

打开http://v.iask.com/v_play.php?vid=10855159会有视频的真实地址: 第14行

<video>  
<result>suee</result>  
<timelength>133567</timelength>  
<framecount>8385</framecount>  
<vname>  
<![CDATA[ 任贤齐-花好月圆夜(MV) ]]>  
</vname>  
<src>400</src>  
<durl>  
<order>1</order>  
<length>133567</length>  
<url>  
<![CDATA[ 
http://edge.v.iask.com/6693405.flv?KID=sina,viask&Expires=1382889600&ssig=gildJVy7AM 
]]>  
</url>  
</durl>  
<vtags>  
<![CDATA[ 任贤齐 花好月圆夜 MV ]]>  
</vtags>  
<ad>  
<![CDATA[ ]]>  
</ad>  
<vstr>  
<![CDATA[ f549fc2ae3611b51682c49072ac1cba7 ]]>  
</vstr>  
<vip>  
<![CDATA[ BAIATFBMVV0BTAEA ]]>  
</vip>  
<vround>20</vround>  
<ext>10855159</ext>  
</video>