From 34f28fc1f08a0b43155d93667be8816c5cd80d76 Mon Sep 17 00:00:00 2001 From: AudricV <74829229+AudricV@users.noreply.github.com> Date: Sun, 8 Sep 2024 17:41:23 +0200 Subject: [PATCH] [YouTube] Remove visitorData usage for shorts continuations It isn't required anymore and not used by extractor anymore since commit 5a6da5f43ebb0a612e6ffdd3feb90d78b3dd383e, as the wrong page ID is used as a visitor data (the VerifiedStatus value as a string). --- .../YoutubeChannelTabExtractor.java | 28 ++----------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelTabExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelTabExtractor.java index 2926d3150..6579d09a4 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelTabExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelTabExtractor.java @@ -42,30 +42,14 @@ import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty; */ public class YoutubeChannelTabExtractor extends ChannelTabExtractor { - /** - * Whether the visitor data extracted from the initial channel response is required to be used - * for continuations. - * - *

- * A valid {@code visitorData} is required to get continuations of shorts in channels. - *

- * - *

- * It should be not used when it is not needed, in order to reduce YouTube's tracking. - *

- */ - private final boolean useVisitorData; private JsonObject jsonResponse; private String channelId; - @Nullable - private String visitorData; @SuppressWarnings("OptionalUsedAsFieldOrParameterType") protected Optional channelHeader; public YoutubeChannelTabExtractor(final StreamingService service, final ListLinkHandler linkHandler) { super(service, linkHandler); - useVisitorData = getName().equals(ChannelTabs.SHORTS); } @Nonnull @@ -100,9 +84,6 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor { jsonResponse = data.jsonResponse; channelHeader = YoutubeChannelHelper.getChannelHeader(jsonResponse); channelId = data.channelId; - if (useVisitorData) { - visitorData = jsonResponse.getObject("responseContext").getString("visitorData"); - } } @Nonnull @@ -176,10 +157,8 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor { channelName, channelUrl) .orElse(null); - final Page nextPage = getNextPageFrom(continuation, - useVisitorData && !isNullOrEmpty(visitorData) - ? List.of(channelName, channelUrl, verifiedStatus.toString(), visitorData) - : List.of(channelName, channelUrl, verifiedStatus.toString())); + final Page nextPage = getNextPageFrom( + continuation, List.of(channelName, channelUrl, verifiedStatus.toString())); return new InfoItemsPage<>(collector, nextPage); } @@ -461,8 +440,7 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor { .getString("token"); final byte[] body = JsonWriter.string(prepareDesktopJsonBuilder(getExtractorLocalization(), - getExtractorContentCountry(), - useVisitorData && channelIds.size() >= 3 ? channelIds.get(2) : null) + getExtractorContentCountry()) .value("continuation", continuation) .done()) .getBytes(StandardCharsets.UTF_8);