Skip to content

Instantly share code, notes, and snippets.

@FrankFan
Created April 7, 2014 14:55
Show Gist options
  • Save FrankFan/10021877 to your computer and use it in GitHub Desktop.
Save FrankFan/10021877 to your computer and use it in GitHub Desktop.
纯js获取QQ空间收藏歌曲列表
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--<meta http-equiv="Refresh" content="3; url=http://www.qidian.com" />-->
<title>获取qq空间收藏音乐</title>
<script type="text/javascript">var h='';
function jsonCallback(data)
{
for(var i=0;i<data.SongList.length;i++)
{
h+=(i+1)+'--歌曲名称:'+'<span style="color:#f00">'+data.SongList[i].songname+'</span>&nbsp;&nbsp;&nbsp;&nbsp;歌手名称:'+data.SongList[i].singername+'</br>';
}
document.getElementsByTagName('body')[0].innerHTML=h;
}
function getMusic()
{
var qqNum=document.getElementById('text').value;
var url='http://qzone-music.qq.com/fcg-bin/fcg_music_fav_getinfo.fcg?dirinfo=0&dirid=1&uin='+parseInt(qqNum)+'&p=0.519638272547262&g_tk=12842dd34856';
createJs(url);
}
</script>
<script type="text/javascript">
function createJs(url)
{
var os=document.createElement('script');
os.type='text/javascript';
os.src=url;
var head=document.getElementsByTagName('head')[0];
head.appendChild(os);
}
</script>
<script type="text/javascript">
window.onload=function redirct2qidian(){
//window.location.href="http://www.qidian.com/";
}
</script>
</head>
<body>
<input type="text" id="text" size="40">
<input type="button" value="go" onclick="getMusic()" />
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment