pythondiscord.pygenius-api

When I use the Genius API, it doesn't give me the full lyrics


When i run this code (discord.py), i do not get the full lyrics:

@commands.command()
async def lyrics(self, ctx, arg1, arg2):
    song = genius.search_song(arg2, arg1)
    print(song)
    embedgenius = discord.Embed(title=arg2.capitalize(), description=arg1.capitalize(), colour=0x69ff00)
    embedgenius.add_field(name="Lyrics:", value=song)
    await ctx.send(embed=embedgenius)

I just get that:

example Polo G - Rapstar:

"RAPSTAR" by Polo G:
[Intro]
(Shout out my n**** Synco)

[Chorus]
Uh (Tuned up), copped a BMW, new deposit, I picked up a...

Solution

  • You're setting the song as the value, not the lyrics.

    embedgenius.add_field(name="Lyrics:", value=song)

    You're basically printing the song object and it having parts of the lyrics in it is just a coincidence. To print the lyrics of a song use song.lyrics. However you should keep in mind that embed fields are limited to 1024 characters.


    @commands.command()
    async def lyrics(self, ctx, arg1, arg2):
        song = genius.search_song(arg2, arg1)
        print(song.lyrics)
        embedgenius = discord.Embed(title=arg2.capitalize(), description=arg1.capitalize(), colour=0x69ff00)
        embedgenius.add_field(name="Lyrics:", value=song.lyrics)
        await ctx.send(embed=embedgenius)