title | date | type | fancybox | comments |
---|---|---|---|---|
音乐 |
2018-02-15 14:32:22 -0800 |
music |
true |
false |
网易云playlist id:
327073149
82292832
2215356763
<style type="text/css">
#playlist {
width: 40%;
font-size: 16px;
/*text-indent: 16px;*/
text-align: center;
}
#nodeGoto {
width: 20%;
color: #222;
font-size: 16px;
height: 40px
text-align: center;
background: #b7daff;
border: solid 2px #b7daff;
cursor: pointer;
}
#playlist, #nodeGoto {
/*float: left;*/
outline: none;
height: 38px;
border: solid 1px #b7daff;
padding: 0;
line-height: 38px;
}
}
</style>
<script type="text/javascript">
function downloadrul(id){
// var url = "https://api.imjad.cn/cloudmusic/?type=url&id=" + id
var url = "https://api.a632079.me/nm/url/" + id
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", url, false ); // false for synchronous request
xmlHttp.send( null );
var res = JSON.parse(xmlHttp.responseText);
var url = res.data[0].url;
// var picurl = res.songs[0].al.picUrl;
// var artist = res.songs[0].ar[0].name;
return(url);
}
function downloadlry(id){
var url = "https://api.imjad.cn/cloudmusic/?type=lyric&id=" + id
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", url, false ); // false for synchronous request
xmlHttp.send( null );
var res = JSON.parse(xmlHttp.responseText);
if ("nolyric" in res){
var lrc = 'None';
}
else{
var lrc = res.lrc.lyric;
}
return(lrc);
}
function downloadname(id){
var url = "https://api.imjad.cn/cloudmusic/?type=detail&id=" + id
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", url, false ); // false for synchronous request
xmlHttp.send( null );
var res = JSON.parse(xmlHttp.responseText);
var name = res.songs[0].name;
var picurl = res.songs[0].al.picUrl;
var artist = res.songs[0].ar[0].name;
return([name , picurl , artist]);
}
function downloadplaylist(id){
var url = "https://api.imjad.cn/cloudmusic/?type=playlist&id=" + id;
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", url, false ); // false for synchronous request
xmlHttp.send( null );
var res = JSON.parse(xmlHttp.responseText);
var id_list =[];
for (ii in res.playlist.tracks){
id_list.push(res.playlist.tracks[ii].id.toString());
}
return(id_list) ;
}
function loadplaylist(playlistid){
// '2215356763'
var arr = downloadplaylist(playlistid)
// var aa = "http://music.163.com/song/media/outer/url?id="
var aa = 'https://api.a632079.me/nm/redirect/music/'
bb = []
for(i in arr){
// alert(i)
var detail = downloadname(arr[i])
var lrc = downloadlry(arr[i])
// var url = downloadrul(arr[i])
// var url = aa + arr[i] +'.mp3'
var url = aa+arr[i]
// alert(lrc)
temp = {
name: detail[0],
artist: detail[2],
url: url,
cover: detail[1],
lrc: lrc,
}
bb.push(temp)
}
return(bb)
}
</script>
<script type="text/javascript">
function showplaylist(){
var input = document.getElementById("playlist");
var bb = loadplaylist(input.value) ;
// alert(bb);
const ap = new APlayer({
container: document.getElementById('player1'),
fixed: false,
lrcType: 1,
audio: bb
});
};
showplaylist();
</script>