网易云音乐网页端提取lrc歌词

网易云音乐网页端提取lrc歌词

  1. 进入目标歌曲网页

    歌曲网页
  2. F12进入检查模式,切换到NetWork面板,按F5截取数据

    Network
  3. 找到lyric?csrf_token=开头的文件,右键Copy--Copy Response

    CopyResponse
  4. 切换到Console,控制台输入a=,然后Crtl+V,得到:

    a=crtlV
  5. 输入a.lrc.lyric得到格式化的歌词

  6. 输入a.tlyric.lyric得到格式化的翻译歌词

    获取歌词
  7. 复制到lrc文件即可

P.S.

歌单信息API接口:

1
http://music.163.com/api/playlist/detail?id=[id]

歌曲真实地址:

1
http://music.163.com/song/media/outer/url?id=[id].mp3

转换程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!usr/bin/env python3
#-*- encoding: utf-8 -*-
__author__ = "QCF"

'''
网易云音乐外链转换
网易云音乐歌单信息
'''

import re

def Translate(url):
# 检查网址正确性
if not (bool(re.match(r'https\://music.163.com/#/playlist\?id\=',url)) or \
bool(re.match(r'https\://music.163.com/#/song\?id\=',url))):
END = (-1, '')
else:
# song_id = re.findall(r'id\=(\d+)',url)
url_class, url_id = re.findall(r'/#/(\w+)\?id\=(\d+)',url)[0]
if url_class == "song":
END = (url_class, "http://music.163.com/song/media/outer/url?id={}.mp3".format(url_id))
elif url_class == "playlist":
END = (url_class, "http://music.163.com/api/playlist/detail?id={}".format(url_id))
else:
END = (-1, '')
return END


if __name__ == "__main__":
while True:
url = input("Please input the url of music.163.com(q to exit):\n\t")
if url == 'q':
break
try:
url_class, url_real = Translate(url)
if url_class == -1:
print("[*]Invaid url")
print('-'*50)
continue
elif url_class == "song":
print("[*]The song's downloading url is:\n\t{}".format(url_real))
print('-'*50)
elif url_class == "playlist":
print("[*]The playlist's infomation url is:\n\t{}".format(url_real))
print('-'*50)
except Exception as e:
print("[*]",e)
print('-'*50)