Skip to content

Instantly share code, notes, and snippets.

View VinayChaurasiyaA's full-sized avatar
🏠
Working from home

VINAY CHAURASIYA VinayChaurasiyaA

🏠
Working from home
View GitHub Profile
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) {
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);
@VinayChaurasiyaA
VinayChaurasiyaA / index.js
Last active August 31, 2024 20:47
JUST A DUMMY
// 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(
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()}`,
{