Skip to main content

A LyricsGenius fork with async ready features.

Project description

AGenius.py

AGenius.py is a LyricsGenius fork, making it easy to use, and async ready.

Key Features

  • Pythonic async/await.
  • Removed every possible instance of the Public API to make it safer.

Setup

You'll need a free Genius account to get access to the Genius API. This provides an access_token that is required.

Installation

Python 3.9 or higher You can use pip:

# Linux
python3 -m pip install agenius

# Windows
py -3 -m pip install agenius

Examples

Importing the package and initiating the main class:

import agenius
genius = agenius.Genius(token)

PUBLIC_API has been removed in this version. You have to pass an access token to the Genius() class.

To search for a specific song, you can either search by the title or song_id:

# by title
song = await genius.search_song("Never Gonna Give You Up", "Rick Astley")

# by song_id
song = await genius.search_song(song_id=84851)

You can also look up artists and their songs via artist_id's:

# look up an artist
artist = await genius.artist(artist_id=artist_id)

# look up their songs
song_list = await genius.artist_songs(artist_id=artist_id, per_page=10, sort="title")

Configurable parameters in the Genius() class:

genius.verbose = False  # Turns status messages off
genius.excluded_terms = ["(Remix)", "(Live)"]  # Exclude songs with these words in their title

Big Examples

Get a song's lyrics

import agenius

genius = agenius.Genius(token)

song = await genius.search_song("Never Gonna Give You Up")
lyrics = song.lyrics

Get a list of an artist's songs, and get the lyrics of every one of them

import agenius
genius = agenius.Genius(token)

async def get_lyrics(artist_id):
    song_list = await genius.artist_songs(artist_id, per_page=50, sort="title")

    lyrics = {}
    async for song in song_list:
        lyrics[song["title"]] = song.lyrics
    return lyrics

License Notice

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agenius-1.0.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

agenius-1.0-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file agenius-1.0.tar.gz.

File metadata

  • Download URL: agenius-1.0.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.4.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.7

File hashes

Hashes for agenius-1.0.tar.gz
Algorithm Hash digest
SHA256 f69c8a97328eeae4f7c408feff975e56912614f78a15cfd2965c68a2cb214c31
MD5 bafe979a3d505f7bb0b434d50da6a4c9
BLAKE2b-256 4862f88f9e7a82c5f64c8afb451f88c01472246bd518dda32560fdf2c8e22075

See more details on using hashes here.

File details

Details for the file agenius-1.0-py3-none-any.whl.

File metadata

  • Download URL: agenius-1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.4.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.7

File hashes

Hashes for agenius-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52c3f93816543d28b4f8c1125be93cbaca1dbd0336cfb68b43a9b6c60deb9a27
MD5 78ec33654aa620d0ee5252418bf49c7b
BLAKE2b-256 78a6b172def8ed78d89a31e1fb7aaca51403723448784fa5b9e4c8fbefd02484

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page