Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

genius 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: #genius #api
ADD COMMENT
Topic
Name
2+9 =