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

Error while trying to get lyrics #35

Closed TaylorDuck72 closed 1 year ago

TaylorDuck72 commented 1 year ago

it threw a SyntaxError while trying to get lyrics from the API

SyntaxError: Unexpected token < in JSON at position 0

IMG_0862

Code:

const lyricsClient = new lyricsFetch.Client()
      const lyricsInput = interaction.options.getString('query');

      try {
      const lyricsSearches = await lyricsClient.songs.search(lyricsInput);
      const lyricsResult = lyricsSearches[0];
      const audioLyrics = await lyricsResult.lyrics();
      } catch(e) 
zyrouge commented 1 year ago

Could you provide reproducible steps and code for this?

Tomato6966 commented 1 year ago

This happens, due to cloudflare, when they respond with: https://milrato.com/codeshare/code/63a03d6f488d917ed402e653

zyrouge commented 1 year ago

This happens, due to cloudflare, when they respond with: https://milrato.com/codeshare/code/63a03d6f488d917ed402e653

There are no solutions for bypassing cloudflare. Only possible way is to use a proxy. Closing this since this cannot be fixed.