Skip to content

fix: tolerate missing thumbnails in all parsers - #978

Merged
sigma67 merged 1 commit into
mainfrom
fix/977-tolerate-missing-thumbnails
Aug 10, 2026
Merged

fix: tolerate missing thumbnails in all parsers#978
sigma67 merged 1 commit into
mainfrom
fix/977-tolerate-missing-thumbnails

Conversation

@sigma67

@sigma67 sigma67 commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Closes #977

#974 made parse_playlist tolerant of entries with no thumbnail renderer, but every other parser still read thumbnail data unconditionally, so the same kind of entry ({} where a renderer is expected) aborts the whole listing elsewhere too.

This applies none_if_absent=True to all remaining thumbnail lookups:

  • parsers/browsing.py: parse_album, parse_single, parse_song, parse_song_flat, parse_related_artist, parse_watch_playlist
  • parsers/albums.py: parse_album_header, parse_album_header_2024
  • parsers/playlists.py: parse_playlist_header_meta (the THUMBNAIL_CROPPED fallback in parse_playlist_header already handles None)
  • parsers/explore.py: parse_chart_playlist, parse_chart_artist
  • parsers/library.py: parse_albums
  • parsers/podcasts.py: parse_base_header, parse_episode, parse_episode_flat, parse_podcast
  • parsers/watch.py: parse_watch_track
  • mixins/podcasts.py: get_channel

parsers/uploads.py was already guarded by an if "thumbnail" in data check, now expressed the same way as the rest.

THUMBNAIL_OVERLAY* lookups in parsers/search.py are untouched — those read videoId/videoType, not thumbnail data.

Tests

tests/parsers/test_thumbnails.py covers the parsers that take a plain renderer dict, asserting thumbnails is None instead of a KeyError. All 11 fail on main and pass with this change. parse_song_flat, parse_episode/parse_episode_flat and parse_uploaded_items need substantially larger fixtures and are covered only by the existing live-API tests.

🤖 Generated with Claude Code

#974 guarded parse_playlist only; the same empty-renderer entries break
every other parser that reads thumbnail data unconditionally.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sigma67
sigma67 merged commit 8068fc3 into main Aug 10, 2026
7 checks passed
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.85%. Comparing base (8d43d07) to head (369e86f).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #978      +/-   ##
==========================================
+ Coverage   95.78%   95.85%   +0.07%     
==========================================
  Files          47       47              
  Lines        2729     2729              
==========================================
+ Hits         2614     2616       +2     
+ Misses        115      113       -2     
Flag Coverage Δ
unittests 95.85% <100.00%> (+0.07%) ⬆️

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

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

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.

get_library_playlists: KeyError 'thumbnails' in parse_playlist for a playlist without artwork (same root cause as #805)

1 participant