作者:手机用户2602916235 | 来源:互联网 | 2018-03-23 19:45
代码
r!=0){
echo "wrong";
return;
}
$urls='';
$cmd='';
foreach($liked_list->songs as $songs){
$urls.=$songs->url.'
';
$title=$songs->title;
//文件名
$offset1=strrpos($songs->url,'/')+1;
$tempName=substr($songs->url,$offset1);
//扩展名
$offset2=strrpos($songs->url,'.');
$ext=substr($songs->url,$offset2);
//生成cmd
$cmd.='ren '.$tempName.' "'.$title.$ext.'"
' ;
}
echo $urls;
echo "
";
echo $cmd;
return;
function login($email,$password)
{
// if(s.contains("@"))
// s2 = "email";
// else
// s2 = "username";
$PostData = "email=".$email."&password=".$password."&app_name=radio_android&version=606&client=s%3Amobile%7Cy%3Aandroid+2.3.5%7Cf%3A606%7Cm%3ADouban%7Cd%3A-1629744272%7Ce%3Ahkcsl_cht_htc_desire_s";
$ch = curl_init("https://www.douban.com/j/app/login");
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_USERAGENT,'Android-2.3.5');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_CAINFO,'mozilla.pem'); /* fixed! */
//post
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $PostData);
$result = curl_exec($ch);
curl_close($ch);
$jsOnObj=json_decode($result);
return $jsonObj;
}
function get_liked($login_info=array(),$count){
$url='http://www.douban.com/j/app/radio/liked_songs?count='.$count.'&token='.$login_info->token.
'&exclude=&version=606&client=s%3Amobile%7Cy%3Aandroid+2.3.5%7Cf%3A606%7Cm%3ADouban%7Cd%3A-1629744272%7Ce%3Ahkcsl_cht_htc_desire_s&app_name=radio_android&from=android_606_Douban'.
'&user_id='.$login_info->user_id.
'&expire='.$login_info->expire.'&formats=aac';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_USERAGENT,'Android-2.3.5');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$curlRespOnse= curl_exec($ch);
$curlErrno = curl_errno($ch);
if ($curlErrno) {
$curlError = curl_error($ch);
}
curl_close($ch);
$jsOnObj=json_decode($curlResponse);
return $jsonObj;
}