// 응답 내용
{
"status": 200,
"singer": "아이유",
"title": "잔소리",
"lyrics": "가사내용"
}
// node-fetch
const fetch = require('node-fetch')
fetch(`https://mora-bot.kr/api/v3/lyrics?singer=[가수]&title=[제목]`)
.then(res => res.json())
.then(json => {
console.log(json)
});
// request
const request = require('request');
let options = {
url: `https://mora-bot.kr/api/v3/lyrics?singer=[가수]&title=[제목]`
}
request.get(options, function (error, response, body) {
if (!error && response.status == 200) {
let json = JSON.parse(body)
console.log(`가사 : ${json.lyrics}`);
} else {
console.log('error = ' + response.errorcode);
}
});
import requests
response = requests.get("https://mora-bot.kr/api/v3/lyrics?singer=[가수]&title=[제목]")
result = response.json()
if response.status_code == 200:
print(result)
else:
print(f"Error Code: {result['status']}")