Skip to content

Commit 34f28fc

Browse files
committed
[YouTube] Remove visitorData usage for shorts continuations
It isn't required anymore and not used by extractor anymore since commit 5a6da5f, as the wrong page ID is used as a visitor data (the VerifiedStatus value as a string).
1 parent f926fbc commit 34f28fc

1 file changed

Lines changed: 3 additions & 25 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelTabExtractor.java

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,14 @@
4242
*/
4343
public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
4444

45-
/**
46-
* Whether the visitor data extracted from the initial channel response is required to be used
47-
* for continuations.
48-
*
49-
* <p>
50-
* A valid {@code visitorData} is required to get continuations of shorts in channels.
51-
* </p>
52-
*
53-
* <p>
54-
* It should be not used when it is not needed, in order to reduce YouTube's tracking.
55-
* </p>
56-
*/
57-
private final boolean useVisitorData;
5845
private JsonObject jsonResponse;
5946
private String channelId;
60-
@Nullable
61-
private String visitorData;
6247
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
6348
protected Optional<YoutubeChannelHelper.ChannelHeader> channelHeader;
6449

6550
public YoutubeChannelTabExtractor(final StreamingService service,
6651
final ListLinkHandler linkHandler) {
6752
super(service, linkHandler);
68-
useVisitorData = getName().equals(ChannelTabs.SHORTS);
6953
}
7054

7155
@Nonnull
@@ -100,9 +84,6 @@ public void onFetchPage(@Nonnull final Downloader downloader) throws IOException
10084
jsonResponse = data.jsonResponse;
10185
channelHeader = YoutubeChannelHelper.getChannelHeader(jsonResponse);
10286
channelId = data.channelId;
103-
if (useVisitorData) {
104-
visitorData = jsonResponse.getObject("responseContext").getString("visitorData");
105-
}
10687
}
10788

10889
@Nonnull
@@ -176,10 +157,8 @@ public InfoItemsPage<InfoItem> getInitialPage() throws IOException, ExtractionEx
176157
channelName, channelUrl)
177158
.orElse(null);
178159

179-
final Page nextPage = getNextPageFrom(continuation,
180-
useVisitorData && !isNullOrEmpty(visitorData)
181-
? List.of(channelName, channelUrl, verifiedStatus.toString(), visitorData)
182-
: List.of(channelName, channelUrl, verifiedStatus.toString()));
160+
final Page nextPage = getNextPageFrom(
161+
continuation, List.of(channelName, channelUrl, verifiedStatus.toString()));
183162

184163
return new InfoItemsPage<>(collector, nextPage);
185164
}
@@ -461,8 +440,7 @@ private Page getNextPageFrom(final JsonObject continuations,
461440
.getString("token");
462441

463442
final byte[] body = JsonWriter.string(prepareDesktopJsonBuilder(getExtractorLocalization(),
464-
getExtractorContentCountry(),
465-
useVisitorData && channelIds.size() >= 3 ? channelIds.get(2) : null)
443+
getExtractorContentCountry())
466444
.value("continuation", continuation)
467445
.done())
468446
.getBytes(StandardCharsets.UTF_8);

0 commit comments

Comments
 (0)