Skip to content

[YouTube] Add support for video lockup content type#1320

Merged
Stypox merged 19 commits intoTeamNewPipe:devfrom
litetex:add-support-for-LOCKUP_CONTENT_TYPE_VIDEO
Jul 16, 2025
Merged

[YouTube] Add support for video lockup content type#1320
Stypox merged 19 commits intoTeamNewPipe:devfrom
litetex:add-support-for-LOCKUP_CONTENT_TYPE_VIDEO

Conversation

@litetex
Copy link
Copy Markdown
Member

@litetex litetex commented Jul 7, 2025

Fixes #1314
Fixes TeamNewPipe/NewPipe#12422

Todo:


Todo for @litetex :


  • I carefully read the contribution guidelines and agree to them.
  • I have tested the API against NewPipe.
  • I agree to create a pull request for NewPipe as soon as possible to make it compatible with the changed API.

Copy link
Copy Markdown
Member

@AudricV AudricV left a comment

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shorts seem to be still returned as compactVideoRenderers, I got two of them within lockupViewModels.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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? :)

@AudricV AudricV changed the title Add support for lockup content type video [YouTube] Add support for video lockup content type Jul 7, 2025
@AudricV AudricV added bug Issue or PR is related to a bug YouTube Service, https://www.youtube.com/ labels Jul 7, 2025
@litetex litetex force-pushed the add-support-for-LOCKUP_CONTENT_TYPE_VIDEO branch 2 times, most recently from 0da7be0 to 8ec54ff Compare July 8, 2025 19:09
@litetex
Copy link
Copy Markdown
Member Author

litetex commented Jul 8, 2025

I don't think nanojson changes should go with this PR

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.

@litetex litetex force-pushed the add-support-for-LOCKUP_CONTENT_TYPE_VIDEO branch from d64c00f to 74323fd Compare July 10, 2025 20:46
@litetex litetex marked this pull request as ready for review July 10, 2025 20:59
@litetex litetex force-pushed the add-support-for-LOCKUP_CONTENT_TYPE_VIDEO branch from 5131fb2 to 370a3b6 Compare July 11, 2025 18:34
@litetex litetex force-pushed the add-support-for-LOCKUP_CONTENT_TYPE_VIDEO branch from aab4ddb to 67548a2 Compare July 12, 2025 10:48
@litetex litetex marked this pull request as draft July 12, 2025 10:50
@litetex
Copy link
Copy Markdown
Member Author

litetex commented Jul 12, 2025

There are currently problems when we encounter videos with multiple uploaders:

https://www.youtube.com/watch?v=Nxk6aRHi664
grafik

@litetex litetex force-pushed the add-support-for-LOCKUP_CONTENT_TYPE_VIDEO branch from 67548a2 to 5a7a8c3 Compare July 12, 2025 11:23
@litetex litetex marked this pull request as ready for review July 12, 2025 11:23
@litetex
Copy link
Copy Markdown
Member Author

litetex commented Jul 12, 2025

There are currently problems when we encounter videos with multiple uploaders

Should be fixed now. A example mock for this will be added with #1332

@litetex litetex force-pushed the add-support-for-LOCKUP_CONTENT_TYPE_VIDEO branch from c186ea3 to 4d7a494 Compare July 13, 2025 18:59
Comment thread extractor/build.gradle Outdated
Comment thread timeago-generator/build.gradle Outdated
litetex and others added 2 commits July 14, 2025 20:31
Co-Authored-By: Audric V. <74829229+AudricV@users.noreply.github.com>
Also cache the streamtype
@Stypox Stypox added this to v0.28.x Jul 14, 2025
@github-project-automation github-project-automation Bot moved this to Todo in v0.28.x Jul 14, 2025
@Stypox Stypox moved this from Todo to In Progress in v0.28.x Jul 14, 2025
Copy link
Copy Markdown
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Thank you! I dynamically debugged the code to look for issues and I think everything is fine. I left a few comments but it's nothing important, everything else LGTM, so feel free to merge after they have been fixed

litetex and others added 2 commits July 15, 2025 22:06
Thanks to Stypox review

* Improved live stream related code
* Fixed Javadoc

Co-Authored-By: Stypox <stypox@pm.me>
Copy link
Copy Markdown
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM! Can be merged after @AudricV also approves.

@Stypox Stypox merged commit a94a6e0 into TeamNewPipe:dev Jul 16, 2025
3 of 4 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in v0.28.x Jul 16, 2025
@litetex litetex deleted the add-support-for-LOCKUP_CONTENT_TYPE_VIDEO branch July 16, 2025 17:20
FineFindus added a commit to FineFindus/NewPipeExtractor that referenced this pull request Jul 26, 2025
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
litetex pushed a commit to FineFindus/NewPipeExtractor that referenced this pull request Jul 26, 2025
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
whistlingwoods pushed a commit to whistlingwoods/TubularExtractor that referenced this pull request Aug 24, 2025
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
whistlingwoods pushed a commit to whistlingwoods/TubularExtractor that referenced this pull request Aug 25, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue or PR is related to a bug YouTube Service, https://www.youtube.com/

Projects

Status: Done

3 participants