Skip to content

fix(innertube): use musicAnimatedThumbnailRenderer backup for video covers#4081

Open
kairosci wants to merge 2 commits into
MetrolistGroup:mainfrom
kairosci:fix/video-animated-cover-thumbnail
Open

fix(innertube): use musicAnimatedThumbnailRenderer backup for video covers#4081
kairosci wants to merge 2 commits into
MetrolistGroup:mainfrom
kairosci:fix/video-animated-cover-thumbnail

Conversation

@kairosci

@kairosci kairosci commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Problem

Video covers served exclusively as animated thumbnails were rendered without a visible cover image throughout the app.

Cause

The ThumbnailRenderer data class parsed musicAnimatedThumbnailRenderer from the YouTube Music API response, but this field was never consulted when resolving thumbnail URLs. Every call site accessed only musicThumbnailRenderer, so animated thumbnails with no static equivalent were silently dropped.

Solution

This commit adds a top-level getThumbnailUrl() function to ThumbnailRenderer that falls through musicThumbnailRenderer, then musicAnimatedThumbnailRenderer.backupRenderer, then croppedSquareThumbnailRenderer. All seventy-seven existing call sites have been migrated from the manual musicThumbnailRenderer?.getThumbnailUrl() pattern to the new unified method, ensuring that the YouTube-provided static fallback inside animated thumbnails is always used.

Testing

Verified that thumbnail images now appear for previously broken video covers across home, library, search, history, album, playlist, podcast, artist, and related content pages.

Related Issues

Closes #4033

Summary by CodeRabbit

  • Bug Fixes
    • Improved thumbnail loading across search, library, home, artist, album, playlist, podcast, history, and related views.
    • More items now display artwork consistently, including songs, albums, playlists, artists, episodes, and podcasts.
    • Added broader fallback handling so thumbnails are less likely to appear missing or blank.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 725c2239-6cfd-41f4-a0ff-6a8aedb74bcd

📥 Commits

Reviewing files that changed from the base of the PR and between 3889662 and afa1d00.

📒 Files selected for processing (1)
  • innertube/src/main/kotlin/com/metrolist/innertube/models/ThumbnailRenderer.kt
💤 Files with no reviewable changes (1)
  • innertube/src/main/kotlin/com/metrolist/innertube/models/ThumbnailRenderer.kt

📝 Walkthrough

Walkthrough

Adds a getThumbnailUrl() helper to ThumbnailRenderer and updates thumbnail extraction across YouTube.kt and innertube page parsers to call it instead of directly traversing musicThumbnailRenderer.

Changes

Thumbnail Extraction Refactor

Layer / File(s) Summary
ThumbnailRenderer fallback helper
innertube/.../models/ThumbnailRenderer.kt
Adds getThumbnailUrl(): String? and removes serialization-specific annotations/imports around the mapping.
YouTube.kt episode/song parsing
innertube/.../YouTube.kt
podcastWithDebug, convertToChartItem, convertMusicTwoRowItem, newEpisodes (shelf and carousel), episodesForLater, and continueListening now use the helper.
Album, Artist item/page parsers
innertube/.../pages/AlbumPage.kt, ArtistItemsPage.kt, ArtistPage.kt
Thumbnail derivation for songs, albums, playlists, artists, episodes, and podcasts switched to getThumbnailUrl().
History, Home, Library pages
innertube/.../pages/HistoryPage.kt, HomePage.kt, LibraryAlbumsPage.kt, LibraryPage.kt
Responsive-list and two-row item builders updated to call getThumbnailUrl() across multiple item types.
New release, Playlist, Podcast, Related pages
innertube/.../pages/NewReleaseAlbumPage.kt, PlaylistPage.kt, PodcastPage.kt, RelatedPage.kt
Thumbnail assignment for songs, albums, playlists, artists, episodes, and podcasts switched to the new helper.
Search pages
innertube/.../pages/SearchPage.kt, SearchSuggestionPage.kt, SearchSummaryPage.kt
All result-type branches updated to derive thumbnails via getThumbnailUrl().

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • MetrolistGroup/Metrolist#4025: Both PRs modify episode parsing logic in YouTube.kt, overlapping on newEpisodes() and episodesForLater() item-creation paths.

Suggested reviewers: nyxiereal

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the core change: adding animated-thumbnail fallback for video covers.
Description check ✅ Passed The description follows the template and includes problem, cause, solution, testing, and related issue details.
Linked Issues check ✅ Passed The changes resolve #4033 by falling back to animated thumbnail backups so music video covers render when static thumbnails are absent.
Out of Scope Changes check ✅ Passed The PR stays focused on thumbnail resolution and related parsing cleanup, with no clear unrelated changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@innertube/src/main/kotlin/com/metrolist/innertube/pages/HistoryPage.kt`:
- Line 63: The `ThumbnailRenderer` model has a serial name collision because
`musicThumbnailRenderer` is aliased to `croppedSquareThumbnailRenderer`, which
conflicts with another property using the same effective serialized name. Update
the serialization mapping in the `ThumbnailRenderer` class by removing that
alias or renaming the conflicting property so each field has a unique serial
name and decoding can succeed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 453d35d2-54e6-42d3-9cff-b15381971170

📥 Commits

Reviewing files that changed from the base of the PR and between 1132598 and 3889662.

📒 Files selected for processing (16)
  • innertube/src/main/kotlin/com/metrolist/innertube/YouTube.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/models/ThumbnailRenderer.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/AlbumPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/ArtistItemsPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/ArtistPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/HistoryPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/HomePage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/LibraryAlbumsPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/LibraryPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/NewReleaseAlbumPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/PlaylistPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/PodcastPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/RelatedPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/SearchPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/SearchSuggestionPage.kt
  • innertube/src/main/kotlin/com/metrolist/innertube/pages/SearchSummaryPage.kt

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.

Covers of music videos are not loading. v13.6.0

1 participant