Python wrapper for api.genius.com
Project description
wrap-genius
Python wrapper for genius.com's API
Setup
wrap-genius is supported on Python 3.8+ 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 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.8.0.tar.gz
(9.3 kB
view details)
Built Distribution
File details
Details for the file wrap-genius-1.8.0.tar.gz
.
File metadata
- Download URL: wrap-genius-1.8.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.0 CPython/3.8.14 Linux/5.15.0-1022-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58403e099c589ddd126d962c47b14e28463a411feae002bf8574ae237817af04 |
|
MD5 | c26ffd533b88e3965a00f87536a8abd6 |
|
BLAKE2b-256 | f2934682b686bde9b97ce44a7b5cb95e90f98e95d8d78b4278e7a3826cf36326 |
File details
Details for the file wrap_genius-1.8.0-py3-none-any.whl
.
File metadata
- Download URL: wrap_genius-1.8.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.0 CPython/3.8.14 Linux/5.15.0-1022-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e717f5964fc3cc1feb2f7a0aed77495b83a477b31f2a132214c2268d0d5ae19a |
|
MD5 | 1825de940927bc348f41bfa9b9b537ce |
|
BLAKE2b-256 | fd7f248ee55be1ae9888eea5043eefd7c523b20270016d95e55322f8e23b727e |