A quick and dirty Python script for searching lyrics/artists/songs on https://api.genius.com, parsing the returned JSON, and outputting it in a CSV file.
Requirements and Setup
Written for Python 2.7 (but could be tweaked for Python 3 pretty easily). Requires a client access token from Genius.com: https://genius.com/api-clients. (Maybe in future will generate authentication from client_id and client_secret.) Add access token credential to "credentials.ini" in project root folder
client_access_token = 'fillinyourtokenhere'
Script passes the access token in a request header as specified in Genius documentation: Using An Access Token.
python search.py 'search terms here'
or if using as imported function
- Only gets 50 pages worth of results (approximately 1000 results). Appears to be a restriction on Genius' end.
- Currently searches not just lyrics for search term, but also song titles and artist names.
- No way to differentiate between genres or between lyrics vs. text content (e.g. speeches, interviews, magazine articles, books)?
- This was just for fun!
First ten results for search for
albee square (web search)