从千千静听歌词服务器下载歌词的代码

转的

将下面代码保存到php文件中即可

<?
/*
作者:gyh
邮箱:pygyh@qq.com
QQ:64125904
*/
function SingleDecToHex($dec)
{
    $tmp=””;
    $dec=$dec%16;
    if($dec<10) return $tmp.$dec;
    $arr=array(“A”,”B”,”C”,”D”,”E”,”F”);
    return $tmp.$arr[$dec-10];
}
function SetToHexString($str)
{
    if(!$str) return false;
    $tmp=””;
    for($i=0;$i<strlen($str);$i++)
    {
        $ord=ord($str[$i]);
        $tmp.=SingleDecToHex(($ord-$ord%16)/16);
        $tmp.=SingleDecToHex($ord%16);
    }
    return $tmp;
}
function qianqian_code($str)
{
        $s=strtolower($str);
        $s=str_replace(” “,””,$s);
        $s=str_replace(“‘”,””,$s);
        return SetToHexString(iconv(‘GBK’,’UTF-16LE’,$s));}

function conv($num)
{
    $tp = bcmod($num,4294967296);

    if(bccomp($num,0)>=0 && bccomp($tp,2147483648)>0)
        $tp=bcadd($tp,-4294967296);
    if(bccomp($num,0)<0 && bccomp($tp,2147483648)<0)
        $tp=bcadd($tp,4294967296);

    return $tp;
}
function CodeFunc($Id,$artist,$title)
{
    $Id=(int)$Id;
    $utf8Str=SetToHexString(iconv(‘GBK’,’UTF-8′,$artist.$title));

    $length=strlen($utf8Str)/2;
    for($i=0;$i<=$length-1;$i++)
        eval(‘$song[‘.$i.’] = 0x’.substr($utf8Str,$i*2,2).’;’);

    $tmp2=0;
    $tmp3=0;

    $tmp1 = ($Id & 0x0000FF00) >> 8; //右移8位后为0x0000015F
//tmp1 0x0000005F
    if ( ($Id & 0x00FF0000) == 0 ) {
        $tmp3 = 0x000000FF & ~$tmp1; //CL 0x000000E7
    } else {
        $tmp3 = 0x000000FF & (($Id & 0x00FF0000) >> 16); //右移16位后为0x00000001
    }
    $tmp3 = $tmp3 | ((0x000000FF & $Id) << 8); //tmp3 0x00001801
    $tmp3 = $tmp3 << 8; //tmp3 0x00180100
    $tmp3 = $tmp3 | (0x000000FF & $tmp1); //tmp3 0x0018015F
    $tmp3 = $tmp3 << 8; //tmp3 0x18015F00
    if ( ($Id & 0xFF000000) == 0 ) {
        $tmp3 = $tmp3 | (0x000000FF & (~$Id)); //tmp3 0x18015FE7
    } else {
        $tmp3 = $tmp3 | (0x000000FF & ($Id >> 24)); //右移24位后为0x00000000
    }

    $i=$length-1;
    while($i >= 0){
        $char = $song[$i];
        if($char >= 0x80) $char = $char – 0x100;

        $tmp1 = ($char + $tmp2) & 0x00000000FFFFFFFF;
        $tmp2 = ($tmp2 << ($i%2 + 4)) & 0x00000000FFFFFFFF;
        $tmp2 = ($tmp1 + $tmp2) & 0x00000000FFFFFFFF;
        $i -= 1;
    }

    $i=0;
    $tmp1=0;
    while($i<=$length-1){
        $char = $song[$i];
        if($char >= 128) $char = $char – 256;
        $tmp7 = ($char + $tmp1) & 0x00000000FFFFFFFF;
        $tmp1 = ($tmp1 << ($i%2 + 3)) & 0x00000000FFFFFFFF;
        $tmp1 = ($tmp1 + $tmp7) & 0x00000000FFFFFFFF;

        $i += 1;
    }

    $t = conv($tmp2 ^ $tmp3);
    $t = conv(($t+($tmp1 | $Id)));
    $t = conv(bcmul($t , ($tmp1 | $tmp3)));
    $t = conv(bcmul($t , ($tmp2 ^ $Id)));

    if(bccomp($t , 2147483648)>0)
         $t = bcadd($t ,- 4294967296);
    return $t;}

$artist=”张韶涵”;
$title=”床边故事”;
$doc = new DOMDocument();
$doc->load(“http://lrccnc.ttplayer.com/dll/lyricsvr.dll?sh?Artist=”.qianqian_code($artist).”&Title=”.qianqian_code($title).”&Flags=0″);
echo “http://lrccnc.ttplayer.com/dll/lyricsvr.dll?sh?Artist=”.qianqian_code($artist).”&Title=”.qianqian_code($title).”&Flags=0″;
echo “<pre>”;
$lrcNode = $doc->getElementsByTagName(“lrc”);
foreach($lrcNode as $lrc)
{
   $id=$lrc->getAttribute(“id”);
   $artist=iconv(‘UTF-8′,’GBK’,$lrc->getAttribute(“artist”));
   $title=iconv(‘UTF-8′,’GBK’,$lrc->getAttribute(“title”));
   $code=CodeFunc($id,$artist,$title);
   $lrcstr=iconv(‘UTF-8′,’GBK’,file_get_contents(“http://lrccnc.ttplayer.com/dll/lyricsvr.dll?dl?Id=”.$id.”&Code=”.$code));
   echo “http://lrccnc.ttplayer.com/dll/lyricsvr.dll?dl?Id=”.$id.”&Code=”.$code;
   echo $lrcstr.”<br/>”;
   break;
}
echo “</pre>”;

?>


( ! ) Warning: Missing argument 1 for cwppos_show_review(), called in /data/www/enjoyphp/wp-content/themes/flat/content-single.php on line 29 and defined in /data/www/enjoyphp/wp-content/plugins/wp-product-review/includes/legacy.php on line 18
Call Stack
#TimeMemoryFunctionLocation
10.0000354824{main}( ).../index.php:0
20.0001355112require( '/data/www/enjoyphp/wp-blog-header.php' ).../index.php:17
30.182310169032require_once( '/data/www/enjoyphp/wp-includes/template-loader.php' ).../wp-blog-header.php:19
40.183510240176include( '/data/www/enjoyphp/wp-content/themes/flat/single.php' ).../template-loader.php:74
50.263310804160get_template_part( ).../single.php:5
60.263310804680locate_template( ).../general-template.php:167
70.263310804776load_template( ).../template.php:643
80.263410805160require( '/data/www/enjoyphp/wp-content/themes/flat/content-single.php' ).../template.php:686
90.269810791656cwppos_show_review( ).../content-single.php:29

2 评论

发表评论

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