fix: album year parsing in .get_artist (#899)#910
Conversation
Mid 2025 YouTube switched the subtitles of albums and singles on an artist page around. Now albums just have a year and singles got merged with eps and therefore have type and year. This commit changes the subtitle parsing so the first entry is treated as the year if it is numeric and otherwise as the type. If a second entry exists and it is numeric it is treated as the year.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adjusts artist-page album/single subtitle parsing to correctly distinguish “type” vs “year” after YouTube’s mid‑2025 subtitle format change.
Changes:
- Added shared subtitle parsing helper to infer
type/yearbased on whether subtitle entries are numeric. - Updated
parse_albumandparse_singleto use the new parsing logic. - Extended
get_artistexpectations/tests to validate year/type parsing (issue #899).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| ytmusicapi/parsers/browsing.py | Introduces shared subtitle parsing and plugs it into album/single parsing. |
| ytmusicapi/mixins/browsing.py | Updates inline example output to include type for singles. |
| tests/mixins/test_browsing.py | Adds assertions to validate parsed type/year for albums and singles. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #910 +/- ##
==========================================
+ Coverage 95.54% 95.55% +0.01%
==========================================
Files 46 46
Lines 2583 2590 +7
==========================================
+ Hits 2468 2475 +7
Misses 115 115
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Mid 2025 YouTube switched the subtitles of albums and singles on an artist page around. Now albums just have a year and singles got merged with eps and therefore have type and year.
This PR changes the subtitle parsing so the first entry is treated as the year if it is numeric and otherwise as the type. If a second entry exists and it is numeric it is treated as the year.
Resolves #899