johnwmillr / LyricsGenius

Download song lyrics and metadata from Genius.com 🎶🎤
http://www.johnwmillr.com/scraping-genius-lyrics/
MIT License
898 stars 159 forks source link

song search BUG! #134

Closed jzr-supove closed 4 years ago

jzr-supove commented 4 years ago
Traceback (most recent call last):
  File "path/to/script", line 238, in <module>
    song = genius.search_song(title='Good Day', artist='Yellow Claw')
  File "home_path\Python\Python37\lib\site-packages\lyricsgenius\api.py", line 267, in search_song
    song_info.update(self.get_song(result['id'])['song'])
TypeError: 'NoneType' object is not subscriptable
nleroy917 commented 4 years ago

Just ran into this myself - Either result is returned as None or song_info.update(self.get_song(result['id']) is returning as None.

nleroy917 commented 4 years ago

Okay, wow. I am dumb and totally forgot to pass in my client secret - I guess that's what I get for copy-pasting code.

@GooDeeJaY Make sure you get your Genius API Access Token from genius and are using that value to initialize the genius object:

genius = lyricsgenius.Genius("<client access token>")

jzr-supove commented 4 years ago

After getting this error, I went back to Genius documentation, read all the stuff and begun writing my own class... and now I'm using that.

Now, reading your comments (@NLeRoy917 ), I tested that, and it is working well. I don't know why I got TypeError. I think that at that time I used a client token, but I wrote <Bearer client_access_token> instead of <client_acess_token>, and that was the mistake..... However, I don't remember what I did at that time.

However, thank you for your response. The problem is solved!