[YouTube] Add support for video lockup content type#1320
[YouTube] Add support for video lockup content type#1320Stypox merged 19 commits intoTeamNewPipe:devfrom
Conversation
AudricV
left a comment
There was a problem hiding this comment.
Thank you. I don't think nanojson changes should go with this PR, as we want to release a new extractor and app version pretty fast. We also want to get rid of this library at some point for something else more efficient.
Please address the following changes and add support for lives (some assumptions you made are wrong for this stream type). Here is a live lockupViewModel, with unneeded fields truncated:
Details
{
"contentImage": {
"thumbnailViewModel": {
"image": {
"sources": [
{
"url": "https://i.ytimg.com/vi/v5oJO79hHLE/hqdefault.jpg?v=686c38a1&sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLCbLDWlnA3yHr3nIXcorQ2ocC1V6w",
"width": 168,
"height": 94
},
{
"url": "https://i.ytimg.com/vi/v5oJO79hHLE/hqdefault.jpg?v=686c38a1&sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCYo3hsLN7uAwIiCCs-8V6MSZorTw",
"width": 336,
"height": 188
}
]
},
"overlays": [
{
"thumbnailOverlayBadgeViewModel": {
"thumbnailBadges": [
{
"thumbnailBadgeViewModel": {
"icon": {
"sources": [
{
"clientResource": {
"imageName": "LIVE"
}
}
]
},
"text": "EN DIRECT",
"badgeStyle": "THUMBNAIL_OVERLAY_BADGE_STYLE_LIVE",
"animationActivationTargetId": "v5oJO79hHLE",
"animationActivationEntityKey": "Eh8veW91dHViZS9hcHAvd2F0Y2gvcGxheWVyX3N0YXRlIMMCKAE%3D",
"lottieData": {
"url": "https://www.gstatic.com/youtube/img/lottie/audio_indicator/audio_indicator_v2.json",
"settings": {
"loop": true,
"autoplay": true
}
},
"animatedText": "En cours de lecture",
"animationActivationEntitySelectorType": "THUMBNAIL_BADGE_ANIMATION_ENTITY_SELECTOR_TYPE_PLAYER_STATE"
}
}
],
"position": "THUMBNAIL_OVERLAY_BADGE_POSITION_BOTTOM_END"
}
}
]
}
},
"metadata": {
"lockupMetadataViewModel": {
"title": {
"content": "PBS News Hour live episode, July 7, 2025"
},
"image": {
"decoratedAvatarViewModel": {
"avatar": {
"avatarViewModel": {
"image": {
"sources": [
{
"url": "https://yt3.ggpht.com/3qIMp79Z-ynhtXTYyNcdybHwvtILVk_jNMKTLbasP8F1UYCdtU-FFjTJPNGQCp5KZuNUQ62n9Gk=s68-c-k-c0x00ffffff-no-rj",
"width": 68,
"height": 68
}
]
},
"avatarImageSize": "AVATAR_SIZE_M"
}
},
"a11yLabel": "Accéder à la chaîne",
"rendererContext": {
"commandContext": {
"onTap": {
"innertubeCommand": {
"commandMetadata": {
"webCommandMetadata": {
"url": "/@PBSNewsHour",
"webPageType": "WEB_PAGE_TYPE_CHANNEL",
"apiUrl": "/youtubei/v1/browse"
}
},
"browseEndpoint": {
"browseId": "UC6ZFN9Tx6xh-skXCuRHCDpQ",
"canonicalBaseUrl": "/@PBSNewsHour"
}
}
}
}
}
}
},
"metadata": {
"contentMetadataViewModel": {
"metadataRows": [
{
"metadataParts": [
{
"text": {
"content": "PBS NewsHour",
"attachmentRuns": [
{
"element": {
"type": {
"imageType": {
"image": {
"sources": [
{
"clientResource": {
"imageName": "CHECK_CIRCLE_FILLED"
},
"width": 14,
"height": 14
}
]
}
}
}
}
}
]
}
}
]
},
{
"metadataParts": [
{
"text": {
"content": "7,9 k spectateurs"
}
}
]
}
],
"delimiter": " • "
}
}
}
},
"contentId": "v5oJO79hHLE",
"contentType": "LOCKUP_CONTENT_TYPE_VIDEO",
"rendererContext": {
"accessibilityContext": {
"label": "PBS News Hour live episode, July 7, 2025"
},
"commandContext": {
"onTap": {
"innertubeCommand": {
"clickTrackingParams": "",
"commandMetadata": {
"webCommandMetadata": {
"url": "/watch?v=v5oJO79hHLE",
"webPageType": "WEB_PAGE_TYPE_WATCH"
}
},
"watchEndpoint": {
"videoId": "v5oJO79hHLE"
}
}
}
}
}
}For premieres, I don't have a way to get one sadly.
If you need help, don't hesitate to ask :)
|
|
||
| @Override | ||
| public boolean isShortFormContent() throws ParsingException { | ||
| // TODO Detect with samples |
There was a problem hiding this comment.
Shorts seem to be still returned as compactVideoRenderers, I got two of them within lockupViewModels.
There was a problem hiding this comment.
I tried to find a video with shorts recommendations but was unable to find a single one (just compilations of shorts lol).
Could you share some example data? :)
0da7be0 to
8ec54ff
Compare
The changes are just 2 new small additional shorthand methods which make writing the code a lot easier, so I would heavily recommend to add them. |
d64c00f to
74323fd
Compare
5131fb2 to
370a3b6
Compare
aab4ddb to
67548a2
Compare
|
There are currently problems when we encounter videos with multiple uploaders: |
67548a2 to
5a7a8c3
Compare
Should be fixed now. A example mock for this will be added with #1332 |
5a7a8c3 to
bd6659c
Compare
c186ea3 to
4d7a494
Compare
Also cache the streamtype
Thanks to Stypox review * Improved live stream related code * Fixed Javadoc Co-Authored-By: Stypox <stypox@pm.me>
Fixes an issue, where the uploader URL for related items would be incorrect, due to the `YoutubeChannelLinkHandlerFactory.getUrl` expecting the id with a `channel/` prefix. However, the `browseId` used to extract the channel id is missing this prefix. Ref: TeamNewPipe#1320
Fixes an issue, where the uploader URL for related items would be incorrect, due to the `YoutubeChannelLinkHandlerFactory.getUrl` expecting the id with a `channel/` prefix. However, the `browseId` used to extract the channel id is missing this prefix. Ref: TeamNewPipe#1320 Fix getUploaderUrl not resolving correct url
Fixes an issue, where the uploader URL for related items would be incorrect, due to the `YoutubeChannelLinkHandlerFactory.getUrl` expecting the id with a `channel/` prefix. However, the `browseId` used to extract the channel id is missing this prefix. Ref: TeamNewPipe/NewPipeExtractor#1320 Fix getUploaderUrl not resolving correct url
Fixes an issue, where the uploader URL for related items would be incorrect, due to the `YoutubeChannelLinkHandlerFactory.getUrl` expecting the id with a `channel/` prefix. However, the `browseId` used to extract the channel id is missing this prefix. Ref: TeamNewPipe/NewPipeExtractor#1320 Fix getUploaderUrl not resolving correct url

Fixes #1314
Fixes TeamNewPipe/NewPipe#12422
Todo:
JsonArray#streamAsshortcut methods nanojson#26 please merge this firstTodo for @litetex :
ParsingExceptiontoRuntimeExceptionbecause otherwise the Java Streaming API sucks (because you can't use it) MakeParsingExceptionaRuntimeException#1328