DEV Community

How to integrate Spotify and Genius API to easily crawl song lyrics with Python

Will Soares on April 08, 2018

This post was originally published on my personal blog. Hello, everyone! For this post, I decided to talk about a Python script I wro...
Collapse
 
1806962 profile image
1806962

Hi i'm wondering one thing. I'm new to coding so be nice.

I downloaded the code from github, i'm testing it on a server, the genius token has been added.

I managed to get beautiful soup and python downloaded for my server. When I use the command python3 get-lyric.py [changes] [2pac] I get told that the song (or any) cannot be found. I have not implemented the spotify side of the code. My understanding was i could test the genius part manually before plugging in the spotify part. What am I doing wrong? Thanks a bunch in advance!

Collapse
 
willamesoares profile image
Will Soares

Hi!

Yeah if you're passing the song and artist name it shoulnd't need to go through dbus stuff, so you'de be fine to just call Genius API.
I'm wondering -- are you running the command with the square brackets around the artist and song name?

Collapse
 
hubtweeting profile image
In need of a band or song name?

This is very cool but is there a way to do this without dbus? I've tried looking for running dbus on windows and it seems pretty unclear.

Collapse
 
itsrainingmani profile image
Manikandan Sundararajan

I created a very similar program but one that used the Spotify API to receive the current playing song and artist - developer.spotify.com/documentatio...

Collapse
 
willamesoares profile image
Will Soares

This is a great alternative! Thanks for pointing it out!

Collapse
 
rhymes profile image
rhymes

Hi Will, nice post!

I don't know why they removed it, they might have had a deal gone south with the lyrics provider: musixmatch.com/

BTW does Genius API expose the annotations?

Collapse
 
willamesoares profile image
Will Soares

Hey, rhymes! I'm glad you liked.

Yes, they do have an endpoint for annotations, it is /annotations/:id

Collapse
 
emmanuelobo profile image
Emmanuel Obogbaimhe

Nice stuff Will. Definitely going to read up on that D-Bus API, very useful stuff. Good work man.

Collapse
 
willamesoares profile image
Will Soares

Thanks Emmanuel, I appreciate your feedback!

Collapse
 
migrmrz profile image
Miguel Ángel

Great content, man. It was very helpful. Thanks!