Skip to content

Instantly share code, notes, and snippets.

@ihewro
Created April 28, 2020 15:36
Show Gist options
  • Save ihewro/e764f5b1935a91c2cded5dac5abda090 to your computer and use it in GitHub Desktop.
Save ihewro/e764f5b1935a91c2cded5dac5abda090 to your computer and use it in GitHub Desktop.
迁移听歌排行音乐到apple music
var content=document.getElementById("m-record");
var items=content.getElementsByTagName("ul")[0].getElementsByTagName("li");
var ret = "";
for(var i=0;i<100;i++){
if (i!=-1){
var n = items[i].getElementsByClassName("song")[0].getElementsByClassName("txt")[0];
var title = n.getElementsByTagName("b")[0].getAttribute("title")
// console.log(n.getElementsByTagName("font")[2]);
if (n.getElementsByClassName("ar s-fc8").length >1){
var author = n.getElementsByClassName("ar s-fc8")[1].getElementsByTagName("span")[0].getAttribute("title")
}else{
var author = n.getElementsByClassName("ar s-fc8")[0].getElementsByTagName("span")[0].getAttribute("title")
}
ret = ret + title + " - " + author+"\n";
}
}
console.log(ret);
@ihewro
Copy link
Author

ihewro commented Apr 28, 2020

https://music.163.com/#/user/songs/rank 在这个页面的控制台执行上面的脚本(执行之前 先点击页面中的「所有时间」)
然后复制输出的结果到https://www.tunemymusic.com/zh-cn/ 这个网站上就可以迁移啦~

@ihewro
Copy link
Author

ihewro commented Nov 6, 2021

这个是我的音乐列表转txt的js脚本

var content=document.getElementById("auto-id-Sv0VhguKOy0wJ6zy");
var items=content.getElementsByTagName("tr");
var ret = "";
for(var i=1;i<=1000;i++){
    if (i!=-1){
        var n = items[i].getElementsByTagName("td");
        var title = n[1].getElementsByTagName("b")[0].getAttribute("title")


        var author = n[3].getElementsByClassName("text")[0].getAttribute("title");
        ret = ret + title + " - " + author+"\n";
    }
}

console.log(ret); 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment