为 ACE 歌曲制作 LRC 歌词

注意:获取 work id 方法:
在“分享”处选择“复制链接”,会得到:
https://mitarie-web.timedomain.tech/share-ace-work.html?work_id=xxxxxx
其中 xxxxxx 就是 work id 。

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
import requests
import json

id = int(input("Please enter your work id:"))
output_path = "work_%i.lrc"%id
headers = {
"Host":"ace-api.timedomain.tech",
"Connection":"keep-alive",
"Accept":"application/json, text/plain, */*",
"Origin":"https://mitarie-web.timedomain.tech",
"platform":"pc",
"User-Agent":"Mozilla/5.0 (Linux; Android 0; WDNMD-AL00 Build/WDNMD-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.116 Mobile Safari/537.36",
"Sec-Fetch-Site":"same-site",
"Sec-Fetch-Mode":"cors",
"Referer":"https://mitarie-web.timedomain.tech/share-ace-work.html?work_id=%i"%id,
"Accept-Encoding":"gzip, deflate"
}

print("Fetching lrc resource")
req = requests.get("http://ace-api.timedomain.tech/api/ace/web/work?work_id=%i"%id, headers=headers).text
lrc_adress = json.loads(req)["data"]["work"]["work_lrc"]
lrc_raw = requests.get(lrc_adress).text

lyrics = json.loads(lrc_raw)["lyrics"]

print("Generating lrc")
txt = ""
for line in lyrics:
mm = line["start_time"]//60
ss = line["start_time"]%60
ms = (ss-int(ss))*100
s = line["text"]
a = "[%02i:%02i.%02i] %s\n" %(mm,int(ss),int(ms),s)
txt += a

print("Writing file")
with open(output_path,"w") as f_out:
f_out.write(txt)

print("Done! File saved:%s"%output_path)

为 ACE 歌曲制作 LRC 歌词
https://ryanmkr.eu.org/tech/phrase_ace_lrc.html
作者
夏和
发布于
2022年10月14日
许可协议