fix: tolerate missing thumbnails in all parsers - #978
Merged
Conversation
#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>
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #977
#974 made
parse_playlisttolerant 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=Trueto all remaining thumbnail lookups:parsers/browsing.py:parse_album,parse_single,parse_song,parse_song_flat,parse_related_artist,parse_watch_playlistparsers/albums.py:parse_album_header,parse_album_header_2024parsers/playlists.py:parse_playlist_header_meta(theTHUMBNAIL_CROPPEDfallback inparse_playlist_headeralready handlesNone)parsers/explore.py:parse_chart_playlist,parse_chart_artistparsers/library.py:parse_albumsparsers/podcasts.py:parse_base_header,parse_episode,parse_episode_flat,parse_podcastparsers/watch.py:parse_watch_trackmixins/podcasts.py:get_channelparsers/uploads.pywas already guarded by anif "thumbnail" in datacheck, now expressed the same way as the rest.THUMBNAIL_OVERLAY*lookups inparsers/search.pyare untouched — those read videoId/videoType, not thumbnail data.Tests
tests/parsers/test_thumbnails.pycovers the parsers that take a plain renderer dict, assertingthumbnails is Noneinstead of aKeyError. All 11 fail onmainand pass with this change.parse_song_flat,parse_episode/parse_episode_flatandparse_uploaded_itemsneed substantially larger fixtures and are covered only by the existing live-API tests.🤖 Generated with Claude Code