导出网易云音乐歌单到 AppleMusic / Spotify 等平台
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 使用方法: | |
* 1. 用 Chrome 打开歌单的 web 页面(可以通过分享拿到链接,链接类似这样:http://music.163.com/playlist?id=xxx&userid=yyy) | |
* 2. 然后右键“检查”(如果有左上角有 device 选项,需要选择 Laptop 开头的,可以在 Edit/编辑 里添加) | |
* 3. 在 console 里输入下面脚本,即可输出 “歌曲名 - 歌手名” 格式的内容: | |
Springsteen - Eric Church | |
Chattahoochee - Alan Jackson | |
Baby Now That I Found You - Alison Krauss | |
Check Yes or No - George Strait | |
Meanwhile Back At Mama's (feat. Faith Hill) - Tim McGraw/Faith Hill | |
。。 | |
* 4.通过 https://www.tunemymusic.com/zh-cn 导出到 Apple Music 或者 Spotify 等音乐平台 | |
*/ | |
(function () { | |
let iframeDocument = document.getElementById("g_iframe").contentDocument; | |
let tempElement = iframeDocument.createElement("div"); | |
function getSinger(trNode) { | |
tempElement.innerHTML = trNode.innerHTML; | |
return tempElement.getElementsByTagName("span")[0].title; | |
} | |
function getSongName(trNode) { | |
tempElement.innerHTML = trNode.innerHTML; | |
return tempElement.getElementsByTagName("b")[0].title; | |
} | |
let allSongsTRNode = iframeDocument.querySelectorAll('table.m-table > tbody > tr') | |
var songsStr = ""; | |
allSongsTRNode.forEach(songTR => { | |
songsStr += (getSongName(songTR.childNodes[1]) + " - " + getSinger(songTR.childNodes[3])); | |
songsStr += "\n"; | |
}); | |
console.log(songsStr); | |
})(); |
-
- 用 Chrome 打开歌单的 web 页面(可以通过分享拿到链接,链接类似这样:http://music.163.com/playlist?id=xxx&userid=yyy)
-
- 然后右键“检查”(如果有左上角有 device 选项,需要选择 Laptop 开头的,可以在 Edit/编辑 里添加)
-
- 在 console 里输入下面脚本,即可输出 “歌曲名 - 歌手名” 格式的内容:
第二条满足吗
切换成Laptop开头的 device后需要再手动刷新下
如果没登录,只显示6首歌,可以点击页面上的分享按钮,登录后会显示1k首歌,再次重复楼主的第三步和第四步,就可以导入1k首了
ps 在手机上操作更顺利
你这个版本chrome下报错,我自己写了一个版本目前是管用的:
https://gist.github.com/tianshuo/957c0e1421ce1d2eeda7ced065b205a5
2023-04-03 我来更新一下,最近我有需求。
(function () {
function getSinger(trNode) {
return trNode.getElementsByClassName("text")[0].title;
}
function getSongName(trNode) {
return trNode.getElementsByTagName("b")[0].title;
}
let allSongsTRNode = document.querySelectorAll('table.m-table > tbody > tr')
var songsStr = "";
allSongsTRNode.forEach(songTR => {
songsStr += (getSongName(songTR) + " - " + getSinger(songTR));
songsStr += "\n";
});
console.log(songsStr);
})();
网易云 web 最多显示歌单的1000首歌,突破其限制可以安装这个油猴脚本
我导出网易云歌单再导入到 Spotify,写了一篇文章,现分享之 https://hellodk.cn/post/1128
It works!
@hellodk34 大佬可以再加一个专辑嘛,歌名-歌手-专辑这样的
使用下面的 js 代码,经测试是 ok 的
(function () {
function getSinger(trNode) {
return trNode.getElementsByClassName("text")[0].title;
}
function getSongName(trNode) {
return trNode.getElementsByTagName("b")[0].title;
}
function getAlbumName(trNode) {
return trNode.getElementsByTagName("td")[4].getElementsByTagName("a")[0].title;
}
let allSongsTRNode = document.querySelectorAll('table.m-table > tbody > tr')
var songsStr = "";
allSongsTRNode.forEach(songTR => {
songsStr += (getSongName(songTR) + " - " + getSinger(songTR) + " - " + getAlbumName(songTR));
songsStr += "\n";
});
console.log(songsStr);
})();
日志如下
Reverie - ILLENIUM/Dana Salah - Ashes
나의 옛날이야기 - (我的老故事) - IU - 꽃갈피
이름에게 - (致姓名) - IU - Palette
逃げるは恥だが役に立つ~あなたに必要とされたくて~ - 末廣健一郎 - TBS系 火曜ドラマ「逃げるは恥だが役に立つ」オリジナル・サウンドトラック Vol.2
마침표 - (终止符) - IU - Palette
ごはんを食べよう - (一起吃饭吧) - Goose house - Goose house Phrase #07 Soundtrack?
糸 - (线) - Aimer - ONE / 花の唄 / 六等星の夜 Magic Blue ver. (初回生産限定盤)
笑顔の花 - (笑靥如花) - Goose house - 笑顔の花
삐삐 - (BBIBBI) - IU - 삐삐
To You. - 雨宮天 - Ring of Fortune
每个减号左右各有一个空格。
使用下面的 js 代码,经测试是 ok 的
(function () { function getSinger(trNode) { return trNode.getElementsByClassName("text")[0].title; } function getSongName(trNode) { return trNode.getElementsByTagName("b")[0].title; } function getAlbumName(trNode) { return trNode.getElementsByTagName("td")[4].getElementsByTagName("a")[0].title; } let allSongsTRNode = document.querySelectorAll('table.m-table > tbody > tr') var songsStr = ""; allSongsTRNode.forEach(songTR => { songsStr += (getSongName(songTR) + " - " + getSinger(songTR) + " - " + getAlbumName(songTR)); songsStr += "\n"; }); console.log(songsStr); })();日志如下
Reverie - ILLENIUM/Dana Salah - Ashes 나의 옛날이야기 - (我的老故事) - IU - 꽃갈피 이름에게 - (致姓名) - IU - Palette 逃げるは恥だが役に立つ~あなたに必要とされたくて~ - 末廣健一郎 - TBS系 火曜ドラマ「逃げるは恥だが役に立つ」オリジナル・サウンドトラック Vol.2 마침표 - (终止符) - IU - Palette ごはんを食べよう - (一起吃饭吧) - Goose house - Goose house Phrase #07 Soundtrack? 糸 - (线) - Aimer - ONE / 花の唄 / 六等星の夜 Magic Blue ver. (初回生産限定盤) 笑顔の花 - (笑靥如花) - Goose house - 笑顔の花 삐삐 - (BBIBBI) - IU - 삐삐 To You. - 雨宮天 - Ring of Fortune
每个减号左右各有一个空格。
感谢
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
奇了怪了,我用 document.getElementById 选择不到。
