가사

Mora Api 가사 입니다.

Templates

  • API는 모두 GET 메서드를 사용합니다

  • GET URL : https://mora-bot.kr/api/v3/lyrics?singer=[가수]&title=[제목]

// 응답 내용
{
    "status": 200,
    "singer": "아이유",
    "title": "잔소리",
    "lyrics": "가사내용"
}

NodeJS

// 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);
    }
});

Python

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']}")

Last updated