|
@@ -29,6 +29,7 @@ const nrc = require('node-run-cmd')
|
|
|
const https = require("node:https");
|
|
|
const {OpenCC} = require("opencc");
|
|
|
const {HttpsProxyAgent} = require("https-proxy-agent");
|
|
|
+const fetch = require("node-fetch");
|
|
|
const converters2t = new OpenCC('s2t.json')
|
|
|
const convertert2s = new OpenCC('t2s.json')
|
|
|
app.use(bodyParser.json({"limit": "200mb"}));
|
|
@@ -229,10 +230,18 @@ app.post('/lyric', async (req, res) => {
|
|
|
let name = req.body.name
|
|
|
let artist = req.body.artist;
|
|
|
let album = req.body.albumName;
|
|
|
+ let lrc = "";
|
|
|
+ await fetchThatShit()
|
|
|
+ async function fetchThatShit() {
|
|
|
+ try {
|
|
|
+ lrc = await (await fetch(`https://api.lrc.cx/api/v1/lyrics/single?title=${name}&album=${album}&artist=${artist}`, {
|
|
|
+ agent: new HttpsProxyAgent("http://localhost:7890")
|
|
|
+ })).text()
|
|
|
+ } catch (err) {
|
|
|
+ await fetchThatShit()
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- let lrc = await (await fetch(`https://api.lrc.cx/api/v1/lyrics/single?title=${name}&album=${album}&artist=${artist}`, {
|
|
|
- agent: new HttpsProxyAgent("http://localhost:7890")
|
|
|
- })).text()
|
|
|
|
|
|
res.header("Access-Control-Allow-Origin", "*");
|
|
|
res.end(lrc)
|