Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

lyrics api

// One way of using the Genius api

try {
  const response = 
    await fetch(`https://api.genius.com/search?q=Kendrick%20Lamar`, {
      method: 'GET',
      headers: {
        'User-Agent': 'CompuServe Classic/1.22',
        'Accept': 'application/json',
        'Host': 'api.genius.com',
        'Authorization': 'Bearer ' + 'replace_with_your_token'
      }
    });
  const data = await response.json();
  if (data.meta.status == 200) {
    return data;
  } else {
    return `Something went wrong: ${data}`;
  }
} catch (error) {
  console.log(error);
}
 
PREVIOUS NEXT
Tagged: #lyrics #api
ADD COMMENT
Topic
Name
2+5 =