lyricsfandom
Scrape music data from LyricsWiki (https://lyrics.fandom.com). Artists, Albums, Songs can be extracted.
Project made during a Deep Learning project for music generation using GPT2 model.
Installation
Install lyricsfandom package from PyPi:
pip install lyricsfandom
Or from GitHub:
git clone https://github.com/arthurdjn/scrape-lyricwiki
cd scrape-lyricwiki
pip install .
Getting Started
LyricsFandom API
You can search for Artist, Album or Song from the API:
from lyricsfandom import LyricWiki
# Connect to the API
wiki = LyricWiki()
# Search for an artist. `LyricsFandom` is not case sensitive.
artist = wiki.search_artist('london grammar')
# Search for an album
album = wiki.search_album('london grammar', 'if you wait')
# ...Or a song
song = wiki.search_song('london grammar', 'strong')
# And retrieve its lyrics
lyrics = song.get_lyrics()
Structure
The package is divided as follows:
- ArtistMeta
- AlbumMeta, inherits from ArtistMeta
- SongMeta, inherits from AlbumMeta
Retrieve data
Once you have one of these objects, you can also access data directly through their methods:
artist = wiki.search_artist('london grammar')
albums = artist.get_albums()
songs = artist.get_songs()
# Idem from an album
album = wiki.search_album('london grammar', 'if you wait')
songs = album.get_songs()
In addition, you can retrieve parent objects from children:
artist = wiki.search_artist('london grammar')
song = artist.search_song('strong')
# Access to parent classes
album = song.get_album()
artist = song.get_artist()
You can scrape for description, links and other details information:
artist = wiki.search_artist('london grammar')
info = artist.get_info() # description of the artist (band members, genres, labels etc.)
links = artist.get_links() # links where to buy the artist's music.
Save and export
You can save data in a JSON format (and encode it to ASCII if you want).
artist = wiki.search_artist('london grammar')
artist_data = artist.to_json(encode='ascii')
# Idem for Album and Song
Efficiency
This package can make a lot of connections while scraping data. Here is a small comparison of different packages, made on scraping 10 songs from an album. pylyrics3 is the fastest to retrieve data, but it only return lyrics on a JSON format (and not OOP). lyricsfandom have similar results, but lyricsmaster is 10 times slower.
Metadata
Release files for lyricsfandom 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lyricsfandom-0.2.1.tar.gz | 498.8 kB | Without provenance | Details |
Release files / lyricsfandom-0.2.1.tar.gz
| Download URL | lyricsfandom-0.2.1.tar.gz |
|---|---|
| Size | 498.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e45c74a1cc43a75caf8994b78cf1388ed2cccc927c97fc137a02ef20cc50691
|
|
BLAKE2b-256 checksum How to use checksums |
de231d50d673639a8490e3719579d04ed168b6aaee62e53591fc88ed25f8294b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.4
|
Security for lyricsfandom 0.2.1
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.