Skip to content

fix(youtube): extract playlist videos from lockups#70

Open
Priveetee wants to merge 1 commit into
InfinityLoop1308:mainfrom
Priveetee:fix-youtube-playlist-lockups
Open

fix(youtube): extract playlist videos from lockups#70
Priveetee wants to merge 1 commit into
InfinityLoop1308:mainfrom
Priveetee:fix-youtube-playlist-lockups

Conversation

@Priveetee

Copy link
Copy Markdown
Contributor

Found while working on TypeType public YouTube playlist support:

Priveetee/TypeType#57

Refs:

Related:

Summary

While working on public YouTube playlist support for TypeType, I found that PipePipeExtractor can load playlist metadata but returns no videos for affected YouTube playlists.

This fixes YouTube playlists returning empty relatedItems when YouTube serves playlist entries as lockupViewModel items instead of the older playlistVideoListRenderer / playlistVideoRenderer layout.

Problem

Current playlist extraction can still load the playlist title, thumbnail and stream count, but relatedItems is empty.

Observed on a public YouTube playlist:

https://www.youtube.com/playlist?list=PL590L5WQmH8fJ54F369BLDSqIwcs-TCfs

title=Google - Year In Search (unofficial)
count=19
items=0
next=false
errors=0

The current response no longer contains the old playlist video renderers:

playlistVideoListRenderer=0
playlistVideoRenderer=0

but it does contain the current lockup format:

lockupViewModel=20

So the extractor was successfully loading the playlist page, but ignored the current video item layout.

Changes

  • Add a fallback path in YoutubePlaylistExtractor when playlistVideoListRenderer is absent.
  • Collect direct lockupViewModel video entries from playlist item sections.
  • Collect nested richItemRenderer.content.lockupViewModel entries too.
  • Reuse YoutubeLockupStreamInfoItemExtractor for LOCKUP_CONTENT_TYPE_VIDEO and LOCKUP_CONTENT_TYPE_EPISODE.
  • Keep playlist uploader name/url as fallback values for playlist video items.
  • Ignore lockup entries without a title instead of adding tolerated item parsing errors.

Validation

  • git diff --check
  • ./gradlew :extractor:compileJava
  • ./gradlew :extractor:compileTestJava
  • Local extractor probe against:
https://www.youtube.com/playlist?list=PL590L5WQmH8fJ54F369BLDSqIwcs-TCfs

Before:

items=0
errors=0

After:

items=14

Sample extracted items:

2016 — Year in Search | https://www.youtube.com/watch?v=KIViy7L_lo8
2015 — Year in Search | https://www.youtube.com/watch?v=q7o7R5BgWDY
2014 — Year in Search | https://www.youtube.com/watch?v=DVwHCGAr_OE

Notes

This is intentionally limited to the playlist extractor. Search and channel tabs already have separate lockup handling paths, so this only fixes playlist pages where PlaylistInfo.getInfo(...) was returning an empty item list.

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.

1 participant