genius-lyrics-ts
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -42,5 +42,10 @@ "use strict"; | ||
const reqUrl = `${searchUrl}${encodeURIComponent(song + " lyrics")}`; | ||
const response = await fetch(reqUrl); | ||
const response = await fetch(reqUrl, { | ||
headers: { | ||
"User-Agent": "Mozilla/5.0 (Windows NT 6.3; Win64; x64)" | ||
} | ||
}); | ||
const html = await response.text(); | ||
const htmlDocument = (0, import_node_html_parser.parse)(html); | ||
console.log({ response, html, htmlDocument }); | ||
let lyrics = htmlDocument.querySelector("[data-lyricid]")?.innerText?.trim(); | ||
@@ -50,4 +55,4 @@ if (!lyrics) | ||
return lyrics; | ||
} catch (e) { | ||
throw e; | ||
} catch (error) { | ||
throw error; | ||
} | ||
@@ -54,0 +59,0 @@ } |
{ | ||
"name": "genius-lyrics-ts", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Get lyrics from google with Typescript, Javascript, or Node", | ||
@@ -28,3 +28,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"happy-dom": "^9.20.3", | ||
"effect": "2.0.0-next.20", | ||
"node-html-parser": "^6.1.5" | ||
@@ -31,0 +31,0 @@ }, |
@@ -0,0 +0,0 @@ # genius-lyrics-ts |
@@ -17,5 +17,10 @@ import { parse } from "node-html-parser"; | ||
const response = await fetch(reqUrl); | ||
const response = await fetch(reqUrl, { | ||
headers: { | ||
"User-Agent": "Mozilla/5.0 (Windows NT 6.3; Win64; x64)", | ||
}, | ||
}); | ||
const html = await response.text(); | ||
const htmlDocument = parse(html); | ||
console.log({ response, html, htmlDocument }); | ||
let lyrics = htmlDocument | ||
@@ -27,4 +32,4 @@ .querySelector("[data-lyricid]") | ||
return lyrics; | ||
} catch (e) { | ||
throw e; | ||
} catch (error) { | ||
throw error; | ||
} | ||
@@ -31,0 +36,0 @@ } |
import getLyrics from "./getLyrics"; | ||
export default getLyrics; |
@@ -0,0 +0,0 @@ export const getTitle = (title: string, artist?: string) => { |
@@ -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
9117
160
+ Addedeffect@2.0.0-next.20
+ Added@effect/data@0.16.3(transitive)
+ Added@effect/io@0.35.3(transitive)
+ Added@effect/match@0.29.1(transitive)
+ Added@effect/schema@0.30.4(transitive)
+ Added@effect/stm@0.19.0(transitive)
+ Added@effect/stream@0.30.1(transitive)
+ Addedeffect@2.0.0-next.20(transitive)
+ Addedfast-check@3.22.0(transitive)
+ Addedpure-rand@6.1.0(transitive)
- Removedhappy-dom@^9.20.3
- Removedcss.escape@1.5.1(transitive)
- Removedhappy-dom@9.20.3(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedwebidl-conversions@7.0.0(transitive)
- Removedwhatwg-encoding@2.0.0(transitive)
- Removedwhatwg-mimetype@3.0.0(transitive)