New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lyricsfetchergenius

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lyricsfetchergenius - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

4

package.json
{
"name": "lyricsfetchergenius",
"version": "0.0.4",
"version": "0.0.5",
"description": "A npm package to fetch lyrics from genius api",

@@ -30,4 +30,4 @@ "main": "index.js",

"axios": "^0.27.2",
"cheerio": "^1.0.0-rc.12"
"cheerio-without-node-native": "^1.0.0-rc.2"
}
}

@@ -1,2 +0,2 @@

# Lyrics Fetcher Genius
# Lyrics Fetcher Genius

@@ -6,2 +6,3 @@ # How to Use

Using GetLyrics:
```js

@@ -29,9 +30,11 @@ const lyricsfetchergenius = require("lyricsfetchergenius");

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;
}
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;
}
};
```

@@ -11,2 +11,3 @@ const axios = require("axios");

if (!ID) throw "No ID was provided";
if (!APIKey) throw "No APIKey was provided";
try {

@@ -17,3 +18,3 @@ let {

},
} = await axios.get(`${songIdURL}${ID}&access_token=${APIKey}`);
} = await axios.get(`${songIdURL}${ID}?access_token=${APIKey}`);
const lyrics = await RetrieveLyrics(Song.url);

@@ -20,0 +21,0 @@ return {

const axios = require("axios");
const cheerio = require("cheerio");
const cheerio = require("cheerio-without-node-native");

@@ -9,10 +9,19 @@ /**

try {
let rawData = await axios.get(url);
const $ = cheerio.load(rawData.data);
const ly = $(".lyrics");
if (ly.length) {
const lyrics = ly.text().trim();
if (!lyrics) return null;
return lyrics;
let { data } = await axios.get(url);
const $ = cheerio.load(data);
let lyrics = $('div[class="lyrics"]').text().trim();
if (!lyrics) {
lyrics = "";
$('div[class^="Lyrics__Container"]').each((i, elem) => {
if ($(elem).text().length !== 0) {
let snippet = $(elem)
.html()
.replace(/<br>/g, "\n")
.replace(/<(?!\s*br\s*\/?)[^>]+>/gi, "");
lyrics += $("<textarea/>").html(snippet).text().trim() + "\n\n";
}
});
}
if (!lyrics) return null;
return lyrics.trim();
} catch (error) {

@@ -19,0 +28,0 @@ throw error;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc