Created
August 12, 2021 13:47
-
-
Save dealingwith/11ca5e660d3873a3e521ad2905e2b5b7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Menu: Genius Lyrics Search | |
let Genius = await npm('genius-lyrics-api') | |
let geniusUserToken = await env("GENIUS_AUTH_TOKEN") | |
import { getLyrics, searchSong } from 'genius-lyrics-api'; | |
let songTitle = await arg("Song Title") | |
let options = { | |
apiKey: geniusUserToken, | |
title: songTitle, | |
artist: '', | |
optimizeQuery: true | |
} | |
let returnedSongs = await(searchSong(options).then((r) => r)) | |
let returnedSongTitles = returnedSongs.map(s => s.title) | |
let chosenSongTitle = await arg("Which song?", returnedSongTitles) | |
let songData = returnedSongs.filter(s => s.title == chosenSongTitle) | |
let lyrics = await(getLyrics(songData[0].url).then((r) => r)) | |
let whatToDo = await arg("", ["Copy", "View", "Visit"]) | |
if (whatToDo == "Copy") copy(lyrics) | |
else if (whatToDo == "View") await textarea(lyrics) | |
else if (whatToDo == "Visit") await focusTab(songData[0].url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment