Skip to content

fix: add fetch_lyrics param to search_album#335

Merged
johnwmillr merged 1 commit into
masterfrom
fix/fetch-lyrics
Mar 9, 2026
Merged

fix: add fetch_lyrics param to search_album#335
johnwmillr merged 1 commit into
masterfrom
fix/fetch-lyrics

Conversation

@johnwmillr

Copy link
Copy Markdown
Owner

Summary

Fixes #217

search_album() was unconditionally scraping lyrics for every track, even when get_full_info=False. This gave users no way to opt out of the expensive per-track web scraping step.

Changes

  • Added fetch_lyrics: bool = True parameter to search_album()
  • When False, skips the lyrics() call for all tracks and returns empty strings instead
  • Two new tests added to tests/test_album.py

Performance impact

On a 10-track album (The Party by Andy Shauf):

Time Requests
Before (no opt-out) ~12s 12
After (fetch_lyrics=False) ~2s 2

Usage

# Skip lyrics scraping — returns metadata only
album = genius.search_album("The Party", "Andy Shauf", fetch_lyrics=False)

Adds fetch_lyrics: bool = True to search_album(). When False, lyrics
scraping is skipped for all tracks, returning only metadata. Reduces
time for a 10-track album from ~12s to ~2s.

Fixes #217
@johnwmillr johnwmillr merged commit f2c5446 into master Mar 9, 2026
10 checks passed
@johnwmillr johnwmillr deleted the fix/fetch-lyrics branch March 9, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Speed issues in search methods

1 participant