[YouTube] Add support for premieres in lockupViewModels#1361
Merged
Stypox merged 5 commits intoTeamNewPipe:devfrom Oct 5, 2025
Merged
[YouTube] Add support for premieres in lockupViewModels#1361Stypox merged 5 commits intoTeamNewPipe:devfrom
Stypox merged 5 commits intoTeamNewPipe:devfrom
Conversation
Member
|
Cool PR. Can we get a test for it? (maybe one that is mock only) |
d0bffcd to
7673ea0
Compare
Member
Author
|
The issue I see is breaking changes with premieres won't be detected. Free feel to find a way to reliably get them or to add a mock only test :) |
litetex
reviewed
Aug 10, 2025
| } | ||
|
|
||
| // As we request a UTC offset of 0 minutes, we get the UTC date | ||
| return LocalDateTime.parse(trimmedTextUploadDate, PREMIERES_DATE_FORMATTER); |
Member
There was a problem hiding this comment.
A few lines above you write "This approach is language dependent"
I think parsing this might crash on different languages, so maybe add a try catch block here?
Member
Author
There was a problem hiding this comment.
We do not support other localizations than en-GB.
This is still interesting to do a try catch and throw a ParsingException when the date could not be parsed.
1 task
The JSON data for these tests was obtained manually.
5c66ca7 to
3c404e5
Compare
Stypox
approved these changes
Oct 5, 2025
Member
Stypox
left a comment
There was a problem hiding this comment.
Thank you! I implemented the remaining suggestions, now this looks good to me. In particular:
- I added mock tests, that load the
JsonObjectfrom file and pass it to theStreamInfoItemExtractor, and then there are a bunch of assertions checking the returned data. I obtained the JSON data by accessing the YouTube website on my PC. - I simplified the date handling code, so that
getTextualUploadDate()returns the raw textual date as it's supposed to do, instead of first parsing it and then formatting it again. This way even if parsing fails, at least the textual date can act as a fallback. - I added a try-catch around date parsing as suggested in a review comment.
AudricV
commented
Oct 5, 2025
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.
This PR adds support for upcoming premieres in video
lockupViewModels. Their structure looks like the following sample for the en-GB interface language (with several fields not different than on regular videos and running livestreams omitted):Details
{ "lockupViewModel": { "contentImage": { "thumbnailViewModel": { "image": {}, "overlays": [ { "thumbnailOverlayBadgeViewModel": { "thumbnailBadges": [ { "thumbnailBadgeViewModel": { "text": "Upcoming", "badgeStyle": "THUMBNAIL_OVERLAY_BADGE_STYLE_DEFAULT", "animationActivationTargetId": "VIDEO_ID", "animationActivationEntityKey": "REDACTED", "lottieData": { "url": "https://www.gstatic.com/youtube/img/lottie/audio_indicator/audio_indicator_v2.json", "settings": { "loop": true, "autoplay": true } }, "animatedText": "Now playing", "animationActivationEntitySelectorType": "THUMBNAIL_BADGE_ANIMATION_ENTITY_SELECTOR_TYPE_PLAYER_STATE" } } ], "position": "THUMBNAIL_OVERLAY_BADGE_POSITION_BOTTOM_END" } }, { "thumbnailHoverOverlayToggleActionsViewModel": { "buttons": [] } } ] } }, "metadata": { "lockupMetadataViewModel": { "title": { "content": "VIDEO_TITLE" }, "image": { "decoratedAvatarViewModel": {} }, "metadata": { "contentMetadataViewModel": { "metadataRows": [ { "metadataParts": [ { "text": { "content": "VIDEO_CHANNEL_NAME", "styleRuns": [], "attachmentRuns": [] } } ] }, { "metadataParts": [ { "text": { "content": "56 waiting" } }, { "text": { "content": "Premieres 14/08/2025, 13:00" } } ] } ], "delimiter": " • " } }, "menuButton": {} } }, "contentId": "VIDEO_ID", "contentType": "LOCKUP_CONTENT_TYPE_VIDEO" } }