From 9fa8d4c0b4f20ab9ec9b77b08a8f39bee3c87eab Mon Sep 17 00:00:00 2001 From: AudricV <74829229+AudricV@users.noreply.github.com> Date: Sat, 23 Mar 2024 23:44:38 +0100 Subject: [PATCH] [YouTube] Support playlists as URL navigation endpoints --- .../services/youtube/YoutubeParsingHelper.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java index 50a7bffd6..53031e734 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java @@ -825,9 +825,15 @@ public final class YoutubeParsingHelper { final String canonicalBaseUrl = browseEndpoint.getString("canonicalBaseUrl"); final String browseId = browseEndpoint.getString("browseId"); - // All channel ids are prefixed with UC - if (browseId != null && browseId.startsWith("UC")) { - return "https://www.youtube.com/channel/" + browseId; + if (browseId != null) { + if (browseId.startsWith("UC")) { + // All channel IDs are prefixed with UC + return "https://www.youtube.com/channel/" + browseId; + } else if (browseId.startsWith("VL")) { + // All playlist IDs are prefixed with VL, which needs to be removed from the + // playlist ID + return "https://www.youtube.com/playlist?list=" + browseId.substring(2); + } } if (!isNullOrEmpty(canonicalBaseUrl)) {