zyrouge / node-genius-lyrics

Simple lyrics fetcher that uses Genius. Also has official API implementations.
https://genius-lyrics.js.org
MIT License
61 stars 12 forks source link

Is it possible to make it run without node (in browser)? #24

Closed f-person closed 2 years ago

f-person commented 2 years ago

Hi! I'm building a browser extension which displays lyrics from Genius in another website. When I try to import this library I get the following error: TypeError: $bGKbb.versions.node is undefined. It will be nice to make this module run in browsers too.

zyrouge commented 2 years ago

It's not possible (considering cors). And that error doesn't seem to come from this module's code. I should be possible to use this on browsers afaik.

f-person commented 2 years ago

And that error doesn't seem to come from this module's code

It happens whenever I try to require("genius-lyrics").

considering cors

It might be possible to use in a background script (not sure, however, need to check)

f-person commented 2 years ago

I'm using https://github.com/fregante/browser-extension-template for the extension BTW

f-person commented 2 years ago

It might be possible to use in a background script

Yup, it's allowed in Chromium (quoting https://www.chromium.org/Home/chromium-security/extension-content-script-fetches):

tl;dr: To improve security, cross-origin fetches will soon be disallowed from content scripts in Chrome Extensions. Such requests can be made from extension background pages instead, and relayed to content scripts when needed.

zyrouge commented 2 years ago

@f-person Do you know where the error comes from? It might be from some dependencies this package is relying on.

f-person commented 2 years ago

Unfortunately, no

zyrouge commented 2 years ago

Unfortunately, no

It should be from somewhere else, there is no such line in this package accessing those properties.

f-person commented 2 years ago

Yup, I grepped it too :(

TrashUwU commented 2 years ago

@zyrouge hi

zyrouge commented 2 years ago

I guess this is the end of the conversation. I'll close this issue since it's stale.