Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

genius-lyrics-ts

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

genius-lyrics-ts - npm Package Compare versions

Comparing version 0.0.29 to 0.0.30

13

dist/index.js

@@ -45,2 +45,12 @@ "use strict";

};
function decodeHTMLEntities(element, str) {
if (str && typeof str === "string") {
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim, "");
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim, "");
element.innerHTML = str;
str = element.textContent;
element.textContent = "";
}
return str;
}

@@ -59,3 +69,4 @@ // src/utils/extractsLyrics.ts

if (elem && elem.textContent?.length !== 0) {
let snippet = elem.innerHTML?.replace(/<br>/g, "\n").replace(/<(?!\s*br\s*\/?)[^>]+>/gi, "").replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim, "");
let snippet = elem.innerHTML?.replace(/<br>/g, "\n").replace(/<(?!\s*br\s*\/?)[^>]+>/gi, "");
snippet = decodeHTMLEntities(elem, snippet);
lyrics += snippet;

@@ -62,0 +73,0 @@ htmlDocument.querySelector("textarea")?.textContent + "\n\n";

2

package.json
{
"name": "genius-lyrics-ts",
"version": "0.0.29",
"version": "0.0.30",
"description": "Get lyrics from genius with Typescript, Javascript, or Node",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

import { parse } from "node-html-parser";
import { decodeHTMLEntities } from ".";

@@ -24,4 +25,4 @@ /**

?.replace(/<br>/g, "\n")
.replace(/<(?!\s*br\s*\/?)[^>]+>/gi, "")
.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim, "");
.replace(/<(?!\s*br\s*\/?)[^>]+>/gi, "");
snippet = decodeHTMLEntities(elem, snippet);
lyrics += snippet;

@@ -28,0 +29,0 @@ htmlDocument.querySelector("textarea")?.textContent + "\n\n";

@@ -0,1 +1,3 @@

import { HTMLElement } from "node-html-parser";
export type Options = {

@@ -34,1 +36,14 @@ apiKey: string;

};
export function decodeHTMLEntities(element: HTMLElement, str: string) {
if (str && typeof str === "string") {
// strip script/html tags
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim, "");
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim, "");
element.innerHTML = str;
str = element.textContent as string;
element.textContent = "";
}
return str;
}

Sorry, the diff of this file is not supported yet

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