python wrapper for api.genius.com
Project description
Python wrapper for genius.com’s API
Installation
wrap-genius is supported on Python 3.6+ and it can be installed using pip
pip install wrap-genius
To be able to use it, you’ll need to create an API client for genius.com and get a CLIENT ACCESS TOKEN.
Quickstart
Assuming you already have you access token, get an instance of the genius wrapper as follows:
from genius import Genius
g = Genius(access_token="YOUR-TOKEN")
With this instance you can interact with genius in many ways:
# Search for an artist by name
artist = g.search_artist("Gorillaz")
print(artist)
>> "Gorillaz (860)"
# Get the artist's social media accounts
instagram = artist.social_media["instagram"]
print(instagram.handle, instagram.followers)
>> "gorillaz 2277483"
# Get the artist's song by popularity
for song in artist.songs_by_popularity:
print(song)
>> "Feel Good Inc. (21569)"
>> "Clint Eastwood (1698)"
>> "Saturnz Barz (3027437)"
>> "Ascension (3027418)"
>> "On Melancholy Hill (53533)"
>> ...
# Get the details of a song by its id
song = g.get_song(song_id=3027414)
print(song.title_with_featured)
print(song.release_date_for_display)
>> "Andromeda (Ft. DRAM)"
>> "March 23, 2017"
# Get the song album, or the featured artists
print(song.album)
for featured in song.features:
print(featured.name)
>> "Humanz (335930)"
>> "DRAM (241761)"
# And even, a song's lyrics
lyrics = song.lyrics
print('\n'.join(lyrics))
>> "[Verse 1: 2-D]"
>> "When the pulsing looks to die for"
>> "Take it in your heart now, lover"
>> "When the case is out"
>> "And tired and sodden"
>> "Take it in your heart"
>> "Take it in your heart"
>> ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wrap-genius-1.2.tar.gz
(9.0 kB
view hashes)
Built Distribution
wrap_genius-1.2-py3-none-any.whl
(11.0 kB
view hashes)
Close
Hashes for wrap_genius-1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5adeef607a70620d4b907fe8ef1c48ed82219d8d228ffd8f2d7819594a7cb906 |
|
MD5 | 52a9e9d130fa8466756460d79c9379e4 |
|
BLAKE2b-256 | 5a6285958d60fc77c75cdbf86baaadb8baf471f0d876c5799d35a58992c5c73e |