获得百度音乐隐蔽API的源代码

接着上篇文章,直接上源代码



header("Content-Type: text/html; charset=utf-8");
require_once "simple_html_dom.php";
$value="老男孩";
$result=find($value);
function find($value)
{
	$qurl='http://music.baidu.com/search?key='.$value;//搜索链接
	$html1=file_get_html($qurl);
	$div=$html1->find('span[class=song-title]',0);
	$link1=$div->first_child ()->href;////获得第二步的http://music.baidu.com/song/5830696

	$link2='http://music.baidu.com/'.$link1.'/download';//在后面加上/download
	$html2=file_get_html($link2);//解析这个页面,也就是下载的那个页面
	$download=$html2->getElementById('download');
	$url=$download->href;//获得想要的链接
	$title=$html2->find('span[class=fwb]',0)->plaintext;//获得歌名
	$author=$html2->find('span[class=author_list]',0)->plaintext;//获得歌手	
	return array('title'=>$title,'author'=>$author,'url'=>substr($url,22));
}
//echo $link1."<br/>";
."<br/>";
//echo substr($url,22);
echo $result['title']."<br/>";
echo $result['author']."<br/>";
echo $result['url'];
?>


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值