[YouTube] Remove visitorData usage for shorts continuations
It isn't required anymore and not used by extractor anymore since commit
5a6da5f43e
, as the wrong page ID is used as a
visitor data (the VerifiedStatus value as a string).
This commit is contained in:
parent
f926fbcf35
commit
34f28fc1f0
|
@ -42,30 +42,14 @@ import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
|
||||||
*/
|
*/
|
||||||
public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
|
public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the visitor data extracted from the initial channel response is required to be used
|
|
||||||
* for continuations.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* A valid {@code visitorData} is required to get continuations of shorts in channels.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* It should be not used when it is not needed, in order to reduce YouTube's tracking.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
private final boolean useVisitorData;
|
|
||||||
private JsonObject jsonResponse;
|
private JsonObject jsonResponse;
|
||||||
private String channelId;
|
private String channelId;
|
||||||
@Nullable
|
|
||||||
private String visitorData;
|
|
||||||
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
||||||
protected Optional<YoutubeChannelHelper.ChannelHeader> channelHeader;
|
protected Optional<YoutubeChannelHelper.ChannelHeader> channelHeader;
|
||||||
|
|
||||||
public YoutubeChannelTabExtractor(final StreamingService service,
|
public YoutubeChannelTabExtractor(final StreamingService service,
|
||||||
final ListLinkHandler linkHandler) {
|
final ListLinkHandler linkHandler) {
|
||||||
super(service, linkHandler);
|
super(service, linkHandler);
|
||||||
useVisitorData = getName().equals(ChannelTabs.SHORTS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -100,9 +84,6 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
|
||||||
jsonResponse = data.jsonResponse;
|
jsonResponse = data.jsonResponse;
|
||||||
channelHeader = YoutubeChannelHelper.getChannelHeader(jsonResponse);
|
channelHeader = YoutubeChannelHelper.getChannelHeader(jsonResponse);
|
||||||
channelId = data.channelId;
|
channelId = data.channelId;
|
||||||
if (useVisitorData) {
|
|
||||||
visitorData = jsonResponse.getObject("responseContext").getString("visitorData");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -176,10 +157,8 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
|
||||||
channelName, channelUrl)
|
channelName, channelUrl)
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
final Page nextPage = getNextPageFrom(continuation,
|
final Page nextPage = getNextPageFrom(
|
||||||
useVisitorData && !isNullOrEmpty(visitorData)
|
continuation, List.of(channelName, channelUrl, verifiedStatus.toString()));
|
||||||
? List.of(channelName, channelUrl, verifiedStatus.toString(), visitorData)
|
|
||||||
: List.of(channelName, channelUrl, verifiedStatus.toString()));
|
|
||||||
|
|
||||||
return new InfoItemsPage<>(collector, nextPage);
|
return new InfoItemsPage<>(collector, nextPage);
|
||||||
}
|
}
|
||||||
|
@ -461,8 +440,7 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
|
||||||
.getString("token");
|
.getString("token");
|
||||||
|
|
||||||
final byte[] body = JsonWriter.string(prepareDesktopJsonBuilder(getExtractorLocalization(),
|
final byte[] body = JsonWriter.string(prepareDesktopJsonBuilder(getExtractorLocalization(),
|
||||||
getExtractorContentCountry(),
|
getExtractorContentCountry())
|
||||||
useVisitorData && channelIds.size() >= 3 ? channelIds.get(2) : null)
|
|
||||||
.value("continuation", continuation)
|
.value("continuation", continuation)
|
||||||
.done())
|
.done())
|
||||||
.getBytes(StandardCharsets.UTF_8);
|
.getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
Loading…
Reference in New Issue