geniuslyricfinder
Advanced tools
Comparing version 1.0.2 to 1.0.3
const fetch = require('node-fetch'); | ||
const randomUseragent = require('random-useragent'); | ||
const cheerios = require('cheerio-without-node-native'); | ||
const htmlEntities = require("html-entities") | ||
const htmlEntities = require("html-entities"); | ||
@@ -18,15 +18,16 @@ const getLyrics = async (query) => { | ||
headers: { | ||
'Accept': 'application/json, text/plain, */*', | ||
'Accept-Language': 'en-GB,en;q=0.9', | ||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', | ||
'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8', | ||
'Accept-Encoding': 'gzip, deflate, br', | ||
'sec-ch-mobile': '?0', | ||
'sec-ch-ua-platform': 'MacPro', | ||
'x-requested-with': 'XMLHttpRequest', | ||
'cookie': '_ga=1', | ||
'cookie': '_genius_ab_test_cohort=66; _genius_ab_test_primis_mobile=control;', | ||
'referer': 'https://genius.com/search/embed', | ||
'referrer-policy': 'strict-origin-when-cross-origin', | ||
'user-agent': randomUseragent.getRandom() | ||
'user-agent': randomUseragent.getRandom(), | ||
'dnt': 1 | ||
} | ||
}) | ||
.then(r => r.json()) | ||
.catch(e => { throw new Error("😢 Genius API failed to search for that song\n" + e) }); | ||
.catch(e => { throw new Error("😢 Genius API dropped the request, retry in one second") }); | ||
@@ -39,11 +40,12 @@ if (multiSearch.response && multiSearch.response.sections && multiSearch.response.sections[0] && multiSearch.response.sections[0].hits && multiSearch.response.sections[0].hits[0] && multiSearch.response.sections[0].hits[0].result && multiSearch.response.sections[0].hits[0].result.url) { | ||
headers: { | ||
'Accept': 'application/json, text/plain, */*', | ||
'Accept-Language': 'en-GB,en;q=0.9', | ||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', | ||
'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8', | ||
'Accept-Encoding': 'gzip, deflate, br', | ||
'sec-ch-mobile': '?0', | ||
'sec-ch-ua-platform': 'MacPro', | ||
'x-requested-with': 'XMLHttpRequest', | ||
'cookie': '_ga=1', | ||
'cookie': '_genius_ab_test_cohort=66; _genius_ab_test_primis_mobile=control;', | ||
'referer': 'https://genius.com/search/embed', | ||
'referrer-policy': 'strict-origin-when-cross-origin', | ||
'user-agent': randomUseragent.getRandom() | ||
'user-agent': randomUseragent.getRandom(), | ||
'dnt': 1 | ||
} | ||
@@ -50,0 +52,0 @@ }) |
{ | ||
"name": "geniuslyricfinder", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Uses genius.com to retrieve song lyrics", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,5 +8,46 @@ # LyricFinder | ||
const geniuslyricfinder = require("geniuslyricfinder") | ||
geniuslyricfinder.getLyrics("Primadonna") | ||
geniuslyricfinder.getLyrics("afterglow becky hill") | ||
.then(r => console.log(r)) | ||
.catch(e => console.log(e)) | ||
``` | ||
## Response | ||
```javascript | ||
{ | ||
artist: 'Wilkinson & Becky Hill', | ||
song: 'Afterglow', | ||
thumbnail: 'https://images.genius.com/d8a609e40816a1ccb0474122ced0f166.1000x1000x1.jpg', | ||
lyrics: "Even though the dancing's done\n" + | ||
"Don't worry cause the night is young\n" + | ||
'Who cares where we go\n' + | ||
"We're ready for the afterglow\n" + | ||
'\n' + | ||
'Someone hold the sunlight back\n' + | ||
'Cause we want this night to last\n' + | ||
'\n' + | ||
'Smoke and lasers, love and ravers\n' + | ||
"Afterglow, we're ready for the afterglow\n" + | ||
'Lights and action, strong attraction\n' + | ||
"Afterglow, we're ready for the afterglow\n" + | ||
'Oh baby, baby\n' + | ||
'\n' + | ||
"Afterglow, we're ready for the afterglow\n" + | ||
'\n' + | ||
"We're ready for the afterglow!\n" + | ||
'\n' + | ||
"Even though the dancing's done\n" + | ||
"Don't worry cause the night is young\n" + | ||
'Who cares where we go\n' + | ||
"We're ready for the afterglow\n" + | ||
'\n' + | ||
'Someone hold the sunlight back\n' + | ||
'Cause we want this night to lastSmoke and lasers, love and ravers\n' + | ||
"Afterglow, we're ready for the afterglow\n" + | ||
'Lights and action, strong attraction\n' + | ||
"Afterglow, we're ready for the afterglow\n" + | ||
'Oh baby, baby\n' + | ||
'Strong attraction\n' + | ||
'Oooh, oooh\n' + | ||
"Afterglow, we're ready for the afterglow" | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5874
70
52