New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error message #77
Comments
I copied the wrong api code, it all works fine! |
Great! Let me know if you run into any other issues. |
Well John, I have one question for you might help me. I have now a long list of artist-song pairs (the 'top 2000') which I would like to use as search query. Do you have any idea how I can best implement this? My goal is to get the 2000 song texts out.
It's rather new for me, so any guidance is helpful.
Many thanks and all the best,
Chris
… Op 10 december 2018 om 1:02 schreef John ***@***.***>:
Great! Let me know if you run into any other issues.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub #77 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/ArmmgxVxim3Bv9UKWJpMErndJurmXQSbks5u3aSYgaJpZM4ZJ06R .
|
Hi Chris, If I understand you correctly, something like this might work for you: # songPairs is a list of song title and artist name pairs
# (e.g. [["I Will", "The Beatles"], ["Begin Again", "Andy Shauf"]])
for pair in songPairs:
song = api.search_song(pair[0], pair[1])
if song:
savename = "Lyrics_{A}_{T}".format(song.title, song.artist)
song.save_lyrics(savename, forma_="txt") Does that seem like what you want? Let me know if it works for you. |
Many thanks Jonn, let me check this out! So far I used the standard 10 hits result and took the first URL. |
Hi Jonn, I'm quite new to Python and trying to retrieve lyrics from genius.com with your package. Unfortunately, I still keep on receiving the error: TypeError: 'NoneType' object is not subscriptable I used the same code as Chris31070 previously posted but it's not working. Can you help me out? Thanks a lot! |
Hi @mrpandastic, what version of the package are you using? If it's not the latest version (1.6.0), try updating with pip install -U lyricsgenius |
yes, 1.6.0 is installed |
I don't get the same error when executing the code. What happens if you try in Python: genius.get_artist(29472) Do you get a lot of data back? Did you properly set up your API key? |
This is what's in my Jupyter Notebook: import lyricsgenius
genius = lyricsgenius.Genius("--mykey--")
artist = genius.search_artist("Eminem", max_songs=3, sort="title")` and this is the error I get: ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-47-08dc5616b4a3> in <module>
2
3 genius = lyricsgenius.Genius("--mykey--")
----> 4 artist = genius.search_artist("Eminem", max_songs=3, sort="title")
~\AppData\Roaming\Python\Python37\site-packages\lyricsgenius\api.py in search_artist(self, artist_name, max_songs, sort, per_page, get_full_info, allow_name_change, artist_id)
294
295 artist_info = self.get_artist(artist_id)
--> 296 found_name = artist_info['artist']['name']
297 if found_name != artist_name and allow_name_change:
298 if self.verbose:
TypeError: 'NoneType' object is not subscriptable |
What happens when you try this? import lyricsgenius
genius = lyricsgenius.Genius("--mykey--")
genius.get_artist(29472) Do you get any data in response? |
No data but also no TypeError. It just says None.
|
Oh it works now. Looks like I'm an idiot who mixed up the client secret and client access token. omg |
Ah, yes, that is a bug. You can open a new issue to log this problem.
John
…On Fri, Aug 9, 2019 at 11:43 AM mrpandastic ***@***.***> wrote:
Hi Chris,
If I understand you correctly, something like this might work for you:
# songPairs is a list of song title and artist name pairs# (e.g. [["I Will", "The Beatles"], ["Begin Again", "Andy Shauf"]])for pair in songPairs:
song = api.search_song(pair[0], pair[1])
if song:
savename = "Lyrics_{A}_{T}".format(song.title, song.artist)
song.save_lyrics(savename, forma_="txt")
Does that seem like what you want? Let me know if it works for you.
John
Hi John,
thanks again for your great help! I have another question: I tried your
code from above regarding song-artist pairs and it doesn't seem to return
the correct result:
`import lyricsgenius
genius = lyricsgenius.Genius("--mykey--")
SongPairs = [['Rocketman', 'Elton John'],['Till I
collapse','Eminem'],['Californication','Red Hot Chili Peppers']]
for pair in SongPairs:
song = genius.search_song(pair[0], pair[1])
lyrics = song.lyrics
print(lyrics)`
2nd and 3rd pair returns the correct lyrics but I don't understand why the
first pair is getting "The One - Prodigy & The Alchemist"?
*P.S. maybe I'm just not familiar with Elton John being a Rapper? haha :D*
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#77?email_source=notifications&email_token=ABFR3CPHAPNYZY3ZJK36QATQDW3G3A5CNFSM4GJHJ2I2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD37PAWY#issuecomment-520024155>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABFR3CINGSREJZ2V6ZRV453QDW3G3ANCNFSM4GJHJ2IQ>
.
|
Hi, I get an error message while using your code:
import lyricsgenius as genius
api = genius.Genius('----my api code ---')
artist = api.search_artist('Andy Shauf', max_songs=3)
Error message:
Traceback (most recent call last):
File "C:/Users/Chris/AppData/Local/Programs/Python/Python37-32/top2000/181208 top2000.py", line 3, in
artist = api.search_artist('Andy Shauf', max_songs=3)
File "C:\Users\Chris\AppData\Local\Programs\Python\Python37-32\lib\site-packages\lyricsgenius\api.py", line 283, in search_artist
found_name = artist_info['artist']['name']
TypeError: 'NoneType' object is not subscriptable
Can you help me with this?
Many thanks!
The text was updated successfully, but these errors were encountered: