Skip to content

Instantly share code, notes, and snippets.

Created March 8, 2016 04:03
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/a800677393bbb2dd113a to your computer and use it in GitHub Desktop.
Save anonymous/a800677393bbb2dd113a to your computer and use it in GitHub Desktop.
合并网易云音乐双语歌词
/**
* 使用方法:
*
* 1、打开 http://music.163.com/
* 2、右键检查(审查元素)
* 3、点击 console
* 4、复制并粘贴本代码
* 5、回车运行
*/
(function(songID){
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://music.163.com/api/song/lyric?lv=-1&tv=-1&id=' + songID, true);
xhr.send();
xhr.onload = function() {
var data = JSON.parse(xhr.responseText);
var lrc = data.lrc.lyric.match(/\[\d+:\d+\.\d+[^\[]+/g);
var tLrc = data.tlyric.lyric.match(/\[\d+:\d+\.\d+[^\[]+/g);
var newLrc = [];
lrc.map(function() {
newLrc.push(lrc[arguments[1]]);
newLrc.push(tLrc[arguments[1]]);
});
window.open('', "_blank", '').document.write(newLrc.join('<br>'));
};
}('28870317')); // 歌曲 ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment