Code Monkey home page Code Monkey logo

Comments (14)

Chris31070 avatar Chris31070 commented on May 28, 2024 1

I copied the wrong api code, it all works fine!

from lyricsgenius.

mrpandastic avatar mrpandastic commented on May 28, 2024 1

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.

import lyricsgenius genius = lyricsgenius.Genius("--mykey--") artist = genius.get_artist(29472) print(artist)

Oh it works now. Looks like I'm an idiot who mixed up the client secret and client access token. omg
Anyway, sorry for bothering you with my questions and thank you so much for your help. Really appreciate it!

from lyricsgenius.

johnwmillr avatar johnwmillr commented on May 28, 2024

Great! Let me know if you run into any other issues.

from lyricsgenius.

Chris31070 avatar Chris31070 commented on May 28, 2024

from lyricsgenius.

johnwmillr avatar johnwmillr commented on May 28, 2024

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

from lyricsgenius.

Chris31070 avatar Chris31070 commented on May 28, 2024

Many thanks Jonn, let me check this out! So far I used the standard 10 hits result and took the first URL.

from lyricsgenius.

mrpandastic avatar mrpandastic commented on May 28, 2024

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!

from lyricsgenius.

johnwmillr avatar johnwmillr commented on May 28, 2024

Hi @mrpandastic, what version of the package are you using? If it's not the latest version (1.6.0), try updating with pip:

pip install -U lyricsgenius

from lyricsgenius.

mrpandastic avatar mrpandastic commented on May 28, 2024

Hi @mrpandastic, what version of the package are you using? If it's not the latest version (1.6.0), try updating with pip:

pip install -U lyricsgenius

yes, 1.6.0 is installed

from lyricsgenius.

johnwmillr avatar johnwmillr commented on May 28, 2024

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?

from lyricsgenius.

mrpandastic avatar mrpandastic commented on May 28, 2024

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

from lyricsgenius.

johnwmillr avatar johnwmillr commented on May 28, 2024

What happens when you try this?

import lyricsgenius
genius = lyricsgenius.Genius("--mykey--")
genius.get_artist(29472)

Do you get any data in response?

from lyricsgenius.

mrpandastic avatar mrpandastic commented on May 28, 2024

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.

import lyricsgenius genius = lyricsgenius.Genius("--mykey--") artist = genius.get_artist(29472) print(artist)

from lyricsgenius.

johnwmillr avatar johnwmillr commented on May 28, 2024

from lyricsgenius.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.