mirror of
https://github.com/AliAkhtari78/SpotifyScraper.git
synced 2026-04-26 03:55:50 +03:00
[PR #48] Fix missing album object in get_track_info() response #33
Labels
No labels
bug
bug
claude-assistant
claude-assistant
claude-assistant
dependencies
documentation
documentation
enhancement
in review list
infrastructure
infrastructure
infrastructure
pull-request
refactoring
release
stale
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SpotifyScraper#33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/AliAkhtari78/SpotifyScraper/pull/48
State: closed
Merged: Yes
Problem
The
SpotifyClient.get_track_info()method was missing thealbumfield in its response, causing KeyError when code tried to accesstrack['album']['name']as shown in the README example.Root Cause
The HTML parser was only extracting track data from the first JSON script tag, which sometimes lacks album-level data. Album information is often embedded in a secondary
application/ld+jsonblob in the page.Solution
extract_track_data_from_page()to check if the album field is missing from the primary track dataextract_album_data_from_jsonld()method to extract album information from JSON-LD script tagstests/unit/test_track_album.pyto verify the fixTesting
test_track_album.pywith two tests:test_track_album_field_present: Verifies the album field is properly extracted by TrackExtractortest_client_get_track_info_album_field: Confirms that the client returns data with the album fieldAll tests pass, ensuring that the
albumfield is consistently available in track data.Changes
Fixes #47.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.