Skip to content

fix: album year parsing in .get_artist (#899)#910

Merged
sigma67 merged 1 commit intosigma67:mainfrom
cedrikewers:cedrikewers/artist-album-subtitle
Apr 24, 2026
Merged

fix: album year parsing in .get_artist (#899)#910
sigma67 merged 1 commit intosigma67:mainfrom
cedrikewers:cedrikewers/artist-album-subtitle

Conversation

@cedrikewers
Copy link
Copy Markdown
Contributor

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

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.
Copilot AI review requested due to automatic review settings April 23, 2026 20:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/year based on whether subtitle entries are numeric.
  • Updated parse_album and parse_single to use the new parsing logic.
  • Extended get_artist expectations/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.

Comment thread tests/mixins/test_browsing.py
Comment thread ytmusicapi/parsers/browsing.py
Comment thread ytmusicapi/parsers/browsing.py
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.55%. Comparing base (416b5d9) to head (20dfaa9).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

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              
Flag Coverage Δ
unittests 95.55% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sigma67 sigma67 merged commit 676fe40 into sigma67:main Apr 24, 2026
8 of 9 checks passed
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.

Wrong year and type field returned by .get_artist

3 participants