https://github.com/sxmabel/lyricsfetchergenius
A npm package to fetch lyrics from genius api
https://github.com/sxmabel/lyricsfetchergenius
genius genius-api genius-lyrics genius-lyrics-api genius-lyrics-search
Last synced: about 1 year ago
JSON representation
A npm package to fetch lyrics from genius api
- Host: GitHub
- URL: https://github.com/sxmabel/lyricsfetchergenius
- Owner: SxMAbel
- License: apache-2.0
- Created: 2022-09-17T00:59:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-18T19:46:26.000Z (over 3 years ago)
- Last Synced: 2025-03-30T17:23:28.373Z (about 1 year ago)
- Topics: genius, genius-api, genius-lyrics, genius-lyrics-api, genius-lyrics-search
- Language: JavaScript
- Homepage: https://abelpurnwasy.ml
- Size: 1.59 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readMe.md
- License: LICENSE
Awesome Lists containing this project
README
# Lyrics Fetcher Genius
# How to Use
# Installation
```
npm install --save lyricsfetchergenius@latest
```
# Methods and Examples in Javascript
[Get the genius APIKey/Token here](https://genius.com/developers)
**Using Typescript**
```ts
import lyricsfetchergenius from "lyricsfetchergenius";
```
**Using Javascript**
Using GetLyrics:
```js
const lyricsfetchergenius = require("lyricsfetchergenius");
// example of options 1
var options = {
APIKey: "your-genius-api-key",
Title: "Late Night Trips",
Artist: "Alex1",
OptimizeQuery: true, // optimizes the query for best results. default is false
AuthHeader: true, // include auth header in the search request. default is false
};
// example of options 2
const APIKey = process.env.APIKEY || "your-genius-api-key";
// below player is erela.js || you can use anything.
const songTitle = player.queue.current.title;
const songArtist = player.queue.current.author;
var options = {
APIKey: APIKey,
Title: songTitle,
Artist: songArtist,
OptimizeQuery: true, // optimizes the query for best results. default is false
AuthHeader: true, // include auth header in the search request. default is false
};
async () => {
try {
let lyrics = await lyricsfetchergenius.GetLyrics(options);
lyrics = lyrics.replace(/(\[.+\])/g, ""); // optional
console.log(lyrics); // you can do somthing else with it other than console.log
} catch (error) {
throw error;
}
};
```
Using GetAlbumArt:
```js
const lyricsfetchergenius = require("lyricsfetchergenius");
// example of options 1
var options = {
APIKey: "your-genius-api-key",
Title: "Late Night Trips",
Artist: "Alex1",
OptimizeQuery: true, // optimizes the query for best results. default is false
AuthHeader: true, // include auth header in the search request. default is false
};
// example of options 2
const APIKey = process.env.APIKEY || "your-genius-api-key";
// below player is erela.js || you can use anything.
const songTitle = player.queue.current.title;
const songArtist = player.queue.current.author;
var options = {
APIKey: APIKey,
Title: songTitle,
Artist: songArtist,
OptimizeQuery: true, // optimizes the query for best results. default is false
AuthHeader: true, // include auth header in the search request. default is false
};
async () => {
try {
const albumArt = await lyricsfetchergenius.GetAlbumArt(options);
console.log(albumArt); // you can do somthing else with it other than console.log
} catch (error) {
throw error;
}
};
```
Using GetSong:
```js
const lyricsfetchergenius = require("lyricsfetchergenius");
// example of options 1
var options = {
APIKey: "your-genius-api-key",
Title: "Late Night Trips",
Artist: "Alex1",
OptimizeQuery: true, // optimizes the query for best results. default is false
AuthHeader: true, // include auth header in the search request. default is false
};
// example of options 2
const APIKey = process.env.APIKEY || "your-genius-api-key";
// below player is erela.js || you can use anything.
const songTitle = player.queue.current.title;
const songArtist = player.queue.current.author;
var options = {
APIKey: APIKey,
Title: songTitle,
Artist: songArtist,
OptimizeQuery: true, // optimizes the query for best results. default is false
AuthHeader: true, // include auth header in the search request. default is false
};
async () => {
try {
const albumArt = await lyricsfetchergenius.GetSong(options); // returns an object
console.log(albumArt); // you can do somthing else with it other than console.log
} catch (error) {
throw error;
}
};
```
Using GetSongByID:
```js
const lyricsfetchergenius = require("lyricsfetchergenius");
const songID = "368385"; // just an example
const APIKey = process.env.APIKEY || "your-genius-api-key";
async () => {
try {
const song = await lyricsfetchergenius.GetSongByID(ID, APIKey); // returns an object
console.log(song); // you can do somthing else with it other than console.log
} catch (error) {
throw error;
}
};
```
Using SearchSong:
```js
const lyricsfetchergenius = require("lyricsfetchergenius");
// example of options 1
var options = {
APIKey: "your-genius-api-key",
Title: "Late Night Trips",
Artist: "Alex1",
OptimizeQuery: true, // optimizes the query for best results. default is false
AuthHeader: true, // include auth header in the search request. default is false
};
// example of options 2
const APIKey = process.env.APIKEY || "your-genius-api-key";
// below player is erela.js || you can use anything.
const songTitle = player.queue.current.title;
const songArtist = player.queue.current.author;
var options = {
APIKey: APIKey,
Title: songTitle,
Artist: songArtist,
OptimizeQuery: true, // optimizes the query for best results. default is false
AuthHeader: true, // include auth header in the search request. default is false
};
async () => {
try {
let song = await lyricsfetchergenius.SearchSong(options);
console.log(song); //returns a object. you can do somthing else with it other than console.log
} catch (error) {
throw error;
}
};
```