Skip to main content

wrap-genius

Version Quality Gate Status CodeCoverage

Unofficial 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

The genius wrapper library provides a convenient interface to interact with the Genius API, allowing you to search for songs, artists, and retrieve information about them. This documentation will guide you through the available functionalities of the library with examples.

Initialization

To start using the genius wrapper library, you need to initialize an instance of the Genius class. This requires an access token, which you can obtain from the Genius API.

from genius import Genius

g = Genius(access_token="YOUR_ACCESS_TOKEN")

Search All

You can use the search_all method to search for songs or artists. It returns a generator that yields search results. Here are some examples:

# Search for an artist
songs = g.search_all("Dua Lipa", page_limit=1) # page_limit is 10 by default, use conservatively if not needed
print(next(songs).title)  # Get the first song
print([song.title for song in songs])  # Get the rest of the songs

# Search for a song
songs = g.search_all("My Iron Lung", page_limit=1)
print(next(songs).title)

# Search for a song by an artist
songs = g.search_all("White Light Gorillaz", page_limit=1)
print(next(songs).title)

Output:

New Rules
['Scared to Be Lonely', 'Don’t Start Now', 'IDGAF', 'Levitating', 'One Kiss', 'Blow Your Mind (Mwah)', 'Break My Heart', 'Be the One', 'Kiss and Make Up', 'Physical', 'Levitating (Remix)', 'UN DÍA (ONE DAY)', 'Electricity', 'We’re Good', 'Homesick', 'Dua Lipa', 'Love Again', 'Dua Lipa & BLACKPINK - Kiss and Make Up (Romanized)', 'Hotter Than Hell']

My Iron Lung

White Light

Search Artist

You can use the search_artist method to search for an artist by their name. It returns an Artist object representing the artist. Here is an example:

artist = g.search_artist("Radiohead")
print(artist)  # Artist object
print(artist.alternate_names)
print(artist.followers_count)
print(artist.description[:100] + "..." if len(artist.description) > 100 else artist.description)
print(artist.header_image_url)
print(artist.id)
print(artist.name)
print(artist.is_verified)
print(list(itertools.islice(artist.songs, 5)))
print(list(itertools.islice(artist.songs_by_popularity, 5)))
print(artist.url)

Search Song

You can use the search_all method to search for a specific song. It returns a generator that yields song objects. Here is an example:

songs = g.search_all("Karma Police Radiohead", page_limit=1)
song = next(songs)
print(song)  # Song object
print(song.album)
print(song.artist)
print(song.pageviews)
print(song.song_art_image_url)
print(song.title)
print(song.title_with_featured)
print(song.hot)
print(song.description)
print(song.recording_location)
print(song.release_date)
print(song.release_date_for_display)
print(song.features)
print(song.media)
print(song.writers)
print(song.producers)
print(song.samples)
print(song.sampled_in)
print(song.interpolates)
print(song.interpolated_by)
print(song.is_cover)
print(song.is_live)
print(song.is_remix)
print(song.cover_of)
print(song.covered_by)
print(song.remix_of)
print(song.remixed_by)
print(song.live_version_of)
print(song.performed_live_as)
print("\n".join(song.lyrics))

Get Artist Information

You can use the get_artist method to retrieve detailed information about an artist by their ID. Here is an example:

artist = g.get_artist(604)
print(artist)  # Artist object

Get Song Information

You can use the get_song method to retrieve detailed information about a song by its ID. Here is an example:

song = g.get_song(378195)
print(song)  # Song object

Get Album Information

You can use the get_all_album_songs method to retrieve information about an album by the artist's ID. Here is an example:

song=g.get_song(378195)
album = song.album
print(album.name)
print(album.artist)
print(album.cover_art_url)
print(album.id)
print(album.url)
print(list(album.songs))

Metadata

Release files for wrap-genius 1.10.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wrap-genius 1.10.2
File Size Uploaded Provenance Actions
wrap_genius-1.10.2.tar.gz 10.2 kB Without provenance Details for wrap_genius-1.10.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wrap-genius 1.10.2
File Interpreter ABI Platform Actions
wrap_genius-1.10.2-py3-none-any.whl Python 3 none any Details for wrap_genius-1.10.2-py3-none-any.whl

Total release size: 22.5 kB

Release files / wrap_genius-1.10.2.tar.gz

Download URL wrap_genius-1.10.2.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6170ad8946dec98b45d724c1e402e741bce69465412bdffb0d87924eb6c7d3f2
BLAKE2b-256 checksum
How to use checksums
8de9d682e8eeae611d33e78e731a414a601b5e33cb8513d3c862c812c36f289d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-1017-azure

Release files / wrap_genius-1.10.2-py3-none-any.whl

Download URL wrap_genius-1.10.2-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae48c4056d4f2906bbb632e7dc970a3eee56bc0039f5a2c476e480bfa87484f9
BLAKE2b-256 checksum
How to use checksums
41c6d6392e658aac9949366ec16894409a1b8971a12173f9987c0b148eceaa42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-1017-azure

Security for wrap-genius 1.10.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page