spotichart.lyrics package¶
Submodules¶
spotichart.lyrics.lyrics_scraper module¶
spotichart.lyrics.lyrics_scraper module.
-
spotichart.lyrics.lyrics_scraper.
scrap_lyrics
(lyrics_url, headers=False, ad_libs=False)¶ Download the lyrics from a resorce located on Genius, by web scraping.
Parameters: - lyrics_url (str) – Link to the Genius lyrics
- headers (bool, optional) – Whether keep section headers or not. Section headers explained on: https://genius.com/9250687, defaults to False
- ad_libs (bool, optional) – Keep the ad-libs sound effects (surrounded by parenthesis). Explained on https://genius.com/9257397, defaults to False
Returns: Lyrics found
Return type: str
spotichart.lyrics.main module¶
spotichart.lyrics.track_features entry module.
-
spotichart.lyrics.main.
get_lyrics
(access_token, track_id, track_name, artist)¶ Get the Lyrics for an individual track
Parameters: - access_token (str) – Genius API Access Token
- track_id (str) – Spotify Track Id, to identify different tracks
- track_name (str) – Track Name to search
- artist (str) – Track’s Artist or Performer
Returns: Dictionary with the song Lyrics, Genius ID an Language identified
Return type: dict
-
spotichart.lyrics.main.
get_lyrics_from_chart
(access_token, chart, sleep=1)¶ Get track lyrics from a DataFrame with ‘Track Id’, ‘Track Name’ and ‘Artist’ columns
Parameters: - access_token (str) – Genius API Access Token
- chart (pandas.DataFrame) – Pandas DataFrame to know Artist and Track Name
- sleep (int, optional) – Sleep timer to rest the scraper, defaults to 1
Returns: Dataframe with Lyrics and Language identified
Return type: pandas.DataFrame
spotichart.lyrics.track_features module¶
spotichart.lyrics.track_features module.
-
spotichart.lyrics.track_features.
request_song_info
(access_token, track_name, artist)¶ Search the track’s metadata in Genius
Parameters: - access_token (str) – Genius API access token
- track_name (str) – Track Name
- artist (str) – Track’s Artist or Performer
Returns: Genius API response
Return type: json
-
spotichart.lyrics.track_features.
search_song
(access_token, track_name, artist)¶ Locate the song’s lyrics in Genius, to know its url
Parameters: - access_token (str) – Genius API Access Token
- track_name (str) – Track Name
- artist (str) – Track’s Artist or Performer
Raises: ValueError – Error on response
Returns: Track’s lyrics and id on Genius
Return type: str
Module contents¶
lyrics package.