genius-lyrics-ts
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -32,8 +32,3 @@ "use strict"; | ||
var getTitle = (title, artist) => { | ||
const validateTitle = title ?? ""; | ||
const validateArtist = artist ?? ""; | ||
if (validateTitle === "" && validateArtist === "") { | ||
return ""; | ||
} | ||
return `${validateTitle} ${validateArtist}`.toLowerCase().replace(/ *\([^)]*\) */g, "").replace(/ *\[[^\]]*]/, "").replace(/feat.|ft./g, "").replace(/\s+/g, " ").trim(); | ||
return `${title} ${artist}`.toLowerCase().replace(/ *\([^)]*\) */g, "").replace(/ *\[[^\]]*]/, "").replace(/feat.|ft./g, "").replace(/\s+/g, " ").trim(); | ||
}; | ||
@@ -47,5 +42,3 @@ | ||
const song = optimizeQuery ? getTitle(title, artist) : `${title} ${artist}`; | ||
const reqUrl = `${searchUrl}${encodeURIComponent( | ||
(song + " lyrics").trim() | ||
)}`; | ||
const reqUrl = `${searchUrl}${encodeURIComponent(song + " lyrics")}`; | ||
const response = await fetch(reqUrl); | ||
@@ -52,0 +45,0 @@ const html = await response.text(); |
{ | ||
"name": "genius-lyrics-ts", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Get lyrics from google with Typescript, Javascript, or Node", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,0 +0,0 @@ # genius-lyrics-ts |
@@ -15,5 +15,3 @@ import { parse } from "node-html-parser"; | ||
const song = optimizeQuery ? getTitle(title, artist) : `${title} ${artist}`; | ||
const reqUrl = `${searchUrl}${encodeURIComponent( | ||
(song + " lyrics").trim() | ||
)}`; | ||
const reqUrl = `${searchUrl}${encodeURIComponent(song + " lyrics")}`; | ||
@@ -20,0 +18,0 @@ const response = await fetch(reqUrl); |
import getLyrics from "./getLyrics"; | ||
export default getLyrics; |
@@ -1,8 +0,3 @@ | ||
export const getTitle = (title?: string, artist?: string) => { | ||
const validateTitle = title ?? ""; | ||
const validateArtist = artist ?? ""; | ||
if (validateTitle === "" && validateArtist === "") { | ||
return ""; | ||
} | ||
return `${validateTitle} ${validateArtist}` | ||
export const getTitle = (title: string, artist?: string) => { | ||
return `${title} ${artist}` | ||
.toLowerCase() | ||
@@ -9,0 +4,0 @@ .replace(/ *\([^)]*\) */g, "") |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
8511
145