This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lyrics.forEach((item) => { | |
let line = document.createElement("div"); | |
// make a progress bar which fills up in the duration of the line | |
let progressBar = document.createElement("div"); | |
line.dataset.time = item.startTimeMs / 1000; | |
progressBar.style.setProperty('--blyrics-duration', `${item.durationMs / 1000}s`); | |
progressBar.classList.add("blyrics--progress-bar"); | |
const words = item.words.split(" "); | |
if (!allZero) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let apiKey = null; | |
injectLyrics: function (lyrics) { | |
let lyricsWrapper = BetterLyrics.DOM.createLyricsWrapper(); | |
BetterLyrics.DOM.addFooter(); | |
try { | |
lyricsWrapper.innerHTML = ""; | |
const lyricsContainer = document.createElement("div"); | |
lyricsContainer.className = BetterLyrics.Constants.LYRICS_CLASS; | |
lyricsWrapper.appendChild(lyricsContainer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Your Genius API access token | |
async function fetchLyricsFromGenius(songTitle) { | |
// const searches = await Client.songs.search("faded"); | |
// const firstSong = searches[0]; | |
// const geniusLyrics = await firstSong.lyrics(); | |
// TODO: add a api call to genius to get the lyrics if there is no lyrics in the current page | |
const accessToken = ""; | |
try { | |
console.log(`Searching for lyrics for "${songTitle}"...`); | |
const response = await fetch( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function fetchLyricsFromGenius(songTitle) { | |
const accessToken = | |
"I CAN DM YOU IF YOU WANT"; | |
try { | |
console.log(`Searching for lyrics for "${songTitle}" from Genius API`); | |
const response = await fetch( | |
`https://api.genius.com/search?q=${encodeURIComponent( | |
songTitle | |
).toLowerCase()}`, | |
{ |