Add endscreen data parsing from YouTube API#22
Open
Eutalix wants to merge 7 commits into
Open
Conversation
Owner
|
Thanks, I'll review this pr later. |
a732336 to
bf4bec3
Compare
- Add EndScreenItem interface for public API contract - Add EndScreen, EndScreenRenderer, EndScreenElement models to parse JSON - Add YouTubeEndScreenItem implementation - Parse endscreen data in WatchNextResult - Expose endscreen items via MediaItemMetadata.getEndScreenItems() The YouTube API already returns endscreen data (interactive elements shown at the end of videos), but it was being ignored. This change adds the parsing layer to make the data available to clients. No UI implementation yet - this is just the data/parsing layer.
bf4bec3 to
7ebe011
Compare
Author
@yuliskov Ok! 🙂 |
added 6 commits
April 9, 2026 18:53
V2 API implementation returns null as end screens are not supported in V2. End screen support is only available in V1 API.
- Replace CommonItems.Thumbnail with ThumbnailItem - Fix thumbnail URL extraction using getThumbnails() - Ensure compatibility with existing codebase structure
- Use youtubeapi.common.helpers.YouTubeHelper instead of googlecommon version - Pass ThumbnailItem directly instead of getThumbnails() list - Fix type compatibility issue with findOptimalResThumbnailUrl
- Add EndScreenElement.getThumbnails() Kotlin extension - Use ThumbnailItem for image field in EndScreenElement - Import Kotlin extension in YouTubeEndScreenItem using static import - Add getEndScreenItems() stub to V2 implementation (returns null) - Fix thumbnail URL extraction using CommonHelperKt.getThumbnails
- Import EndScreenElement at the top of CommonHelper.kt - Ensure Kotlin extension function compiles correctly
- Add getThumbnails() extension at top level (not inside function) - Import EndScreenElement at file header - Ensure proper Kotlin syntax and scope
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.
Summary
This PR adds parsing support for YouTube end screens - the interactive elements that appear near the end of videos (recommended videos, channels, subscribe buttons, playlists).
The YouTube API already returns this data in the response, but it was being completely ignored by the parsers.
Changes
New Interfaces
EndScreenItem- Public API contract for endscreen elementsNew Models (JSON parsing)
EndScreen- Root endscreen objectEndScreenRenderer- Container for endscreen elementsEndScreenElement- Individual endscreen element with positioning, timing, and contentImplementation
YouTubeEndScreenItem- Converts parsed JSON models toEndScreenIteminterfaceIntegration
WatchNextResultto parse$.endscreenfrom API responseMediaItemMetadatainterface to exposegetEndScreenItems()YouTubeMediaItemMetadatato populate endscreen items from parsed dataAPI Data Structure
Each endscreen element contains:
VIDEO,CHANNEL,PLAYLISTstartMs,endMs(when to show/hide)left,top,width,aspectRatio(layout coordinates)videoId,channelId, orplaylistId(where it links to)Testing
The API already returns this data - verified in existing test fixtures:
youtubeapi/src/test/resources/video_info/get_video_info.jsonNext Steps
This PR only adds the parsing/data layer. Future work needed:
Videomodel