📄 getmusiclist_out.php
字号:
<?
require 'function.php';
$page=$_REQUEST['page']?$_REQUEST['page']:1;
//
//echo 'http://d.sogou.com/music.so?query='.$_REQUEST['musicName'].'&page='.$page;
$sogouListText =file_get_contents('http://d.sogou.com/music.so?query='.$_REQUEST['musicName'].'&page='.$page);
//沒有搜到#0个结果
if(preg_match("(共找到 0个结果|请检查查询词是否正确)", $sogouListText))
{
if(preg_match("(您要找的是不是)", $sogouListText))
{
$sogouListText =explode('您要找的是不是',$sogouListText);
$sogouListText =explode('<a',$sogouListText[1]);
$sogouListText =getHtmlContent($sogouListText[1],'>','<');
$sogouListText ='您要找的是不是 “<a href="javascript:void(0)" onclick="load_list_p(\''.$sogouListText.'\',\'1\')">'.$sogouListText.'</a>” ';
}else
{
$sogouListText ='';
}
$html='
<div class="url_list_h">
<strong>“'.rawurldecode($_REQUEST['t']).'”</strong>
的搜索结果 为0个结果! '.$sogouListText.' <img src="img/question.gif" />提示:1.请检查查询词是否正确。2.如果查询词较长,请简化后再试一次。
</div>';
}else
{
//有结果
$sogouListText =explode('colspan=13',$sogouListText);
//得到列表组
$j =0;
for($i=0;$i<count($sogouListText);$i++)
{
$tmp =explode('<tr bgcolor=#F6F',$sogouListText[$i]);
//print_r($tmp);
foreach($tmp as $value)
{
$tmp2 =getHtmlContent($value,'6F6>','</tr>');
//if(strlen($value)>20)
//{
$tmp3 =explode('</td>',$tmp2);
//标题
//$Title =getHtmlContent($tmp3[1],">","<",1);//..
$Title =getHtmlContent($tmp3[0],'title="','"',1);
//歌星
//$Artist =getHtmlContent($tmp3[2],">","<",1);//..
$Artist =getHtmlContent($tmp3[1],'title="','"',1);
//专集
//$Album =getHtmlContent($tmp3[3],">","<",1);//..
$Album =getHtmlContent($tmp3[2],'title="','"',1);
//格试
$Type =getHtmlContent($tmp3[3],'center>','<');
//大小
$Size =getHtmlContent($tmp3[4],'center>','<');
//歌词
$lyric =getHtmlContent($tmp3[8],'geci.so?lyricid=','"');
//下载页面 down.so?groupid=
$downUrl=getHtmlContent($tmp3[6],'groupid=','\',');
//得到url http://d.sogou.com/down.so?groupid=13f27514cb14d7ba&t=%B2%BB%BC%FB&s=%D1%EE%D8%A9%C1%D5&c
//$downUrl =getHtmlMusic(file_get_contents('http://d.sogou.com/down.so?groupid='.$downUrl));
if(strlen($Title)>2)
{
$sogouListDateArray[$j][] =array(
'Title' =>$Title,
'Artist' =>$Artist,
'Album' =>$Album,
'Type' =>$Type,
'Size' =>$Size,
'lyric' =>$lyric,
'downUrl' =>$downUrl
);
}
//}
}
$j++; //歌曲组
}
//print_r($sogouListDatrrayeA);
$html='
<div class="url_list_h">
<strong>“'.rawurldecode($_REQUEST['t']).'”</strong>
的搜索结果
<img src="img/question.gif" /> 如果没有找到你想听的歌? 那就请点击 =>'.(($page>1)?'<a href="javascript:void(0)" onclick="load_list_p(\''.$_REQUEST['musicName'].'\',\''.($page-1).'\')">上一页</a>':'').' <a href="javascript:void(0)" onclick="load_list_p(\''.$_REQUEST['musicName'].'\',\''.($page+1).'\')">下一页</a>
</div>';
foreach($sogouListDateArray as $key => $value)
{
$html.='<div class="url_list_p" id="url_list_'.$key.'">';
foreach($value as $key2 => $value2)
{
if($key==0 and $key2==0) $fJs="op_url_list('".$value2['downUrl']."','url_list_".$key."_".$key2."');";//得到第一个list
$html.='<table width="100%" border="0" cellspacing="0" cellpadding="0" ondblclick="op_url_list(\''.$value2['downUrl'].'\',\'url_list_'.$key.'_'.$key2.'\')">
<tr>
<td width="8%">
<a href="javascript:void(0)" onFocus="this.blur()" id="url_list_'.$key.'_'.$key2.'_a" onclick="op_url_list(\''.$value2['downUrl'].'\',\'url_list_'.$key.'_'.$key2.'\')" title="点击展开网址"><img src="img/musicfolder.gif" border="0"/>展开</a></td>
<td width="40%">歌名:<b><a href="javascript:void(0)" id="url_list_'.$key.'_'.$key2.'_Title" onclick="load_list_p(\''.$value2['Title'].'\',\'1\')">'.$value2['Title'].'</a></b>'.($value2['lyric']?'<a href="javascript:void(0)" onclick="load_list_lyric(\''.$value2['lyric'].'\',\'url_list_'.$key.'_'.$key2.'\')" title="歌词"><img src="img/micon_6on.gif" border="0"/></a>':'').'</td>
<td width="12%">歌手:<a href="javascript:void(0)" id="url_list_'.$key.'_'.$key2.'_Artist" onclick="load_list_p(\''.$value2['Artist'].'\',\'1\')">'.$value2['Artist'].'</a></td>
<td width="20%">专辑:<a href="javascript:void(0)" id="url_list_'.$key.'_'.$key2.'_Album" onclick="load_list_p(\''.$value2['Album'].'\',\'1\')">'.$value2['Album'].'</a></td>
<td width="10%">格式:'.$value2['Type'].'</td>
<td width="10%">大小:'.$value2['Size'].'</td>
</tr>
</table>
<div ondblclick="load_list_lyric(\''.$value2['lyric'].'\',\'url_list_'.$key.'_'.$key2.'\')" class="url_list_lyric" id="url_list_'.$key.'_'.$key2.'_lyric" style="display:none"></div>
<div ondblclick="op_url_list(\''.$value2['downUrl'].'\',\'url_list_'.$key.'_'.$key2.'\')" class="url_list_s" id="url_list_'.$key.'_'.$key2.'" style="display:none">
</div>';
} // end foreach 2
$html.='</div>';
}// end foreach 1
}
header("Content-type: application/xml");
echo OutXmlStr($html);
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -