zyrouge / node-genius-lyrics

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

403 - Error, wrong url? #27

Closed verbindolai closed 2 years ago

verbindolai commented 2 years ago

Im having issues when trying to get the songs from an artist, im always getting an 403 Error with the message "Action forbidden for current scope".

I think it's because the url called looks like this: api.genius.com/songs?page=1&per_page=20&sort=title, But shouldn't it look more like this api.genius.com/artist/1234567/songs?page=1&per_page=20&sort=title ?

https://github.com/zyrouge/node-genius-lyrics/blob/f90c6c8ec7cb8b154a704231052b77c9ae4c48cf/lib/artists/artist.ts#L103-L106

I changed this block to use the correct url and fixed access to the response like this:

...
const data = await this.client.api.get(
      `/artists/${this.id}/songs?page=${nOptions.page}&per_page=${nOptions.perPage}&sort=${nOptions.sort}`
);
const parsed = JSON.parse(data).response; // Added the .response
...

And it works for me. Did i found a bug or am i just missing something?

zyrouge commented 2 years ago

It's probably me who messed up. I'll push a fix.

zyrouge commented 2 years ago

Fixed in v4.3.7!