|
42 | 42 | */ |
43 | 43 | public class YoutubeChannelTabExtractor extends ChannelTabExtractor { |
44 | 44 |
|
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; |
58 | 45 | private JsonObject jsonResponse; |
59 | 46 | private String channelId; |
60 | | - @Nullable |
61 | | - private String visitorData; |
62 | 47 | @SuppressWarnings("OptionalUsedAsFieldOrParameterType") |
63 | 48 | protected Optional<YoutubeChannelHelper.ChannelHeader> channelHeader; |
64 | 49 |
|
65 | 50 | public YoutubeChannelTabExtractor(final StreamingService service, |
66 | 51 | final ListLinkHandler linkHandler) { |
67 | 52 | super(service, linkHandler); |
68 | | - useVisitorData = getName().equals(ChannelTabs.SHORTS); |
69 | 53 | } |
70 | 54 |
|
71 | 55 | @Nonnull |
@@ -100,9 +84,6 @@ public void onFetchPage(@Nonnull final Downloader downloader) throws IOException |
100 | 84 | jsonResponse = data.jsonResponse; |
101 | 85 | channelHeader = YoutubeChannelHelper.getChannelHeader(jsonResponse); |
102 | 86 | channelId = data.channelId; |
103 | | - if (useVisitorData) { |
104 | | - visitorData = jsonResponse.getObject("responseContext").getString("visitorData"); |
105 | | - } |
106 | 87 | } |
107 | 88 |
|
108 | 89 | @Nonnull |
@@ -176,10 +157,8 @@ public InfoItemsPage<InfoItem> getInitialPage() throws IOException, ExtractionEx |
176 | 157 | channelName, channelUrl) |
177 | 158 | .orElse(null); |
178 | 159 |
|
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())); |
183 | 162 |
|
184 | 163 | return new InfoItemsPage<>(collector, nextPage); |
185 | 164 | } |
@@ -461,8 +440,7 @@ private Page getNextPageFrom(final JsonObject continuations, |
461 | 440 | .getString("token"); |
462 | 441 |
|
463 | 442 | final byte[] body = JsonWriter.string(prepareDesktopJsonBuilder(getExtractorLocalization(), |
464 | | - getExtractorContentCountry(), |
465 | | - useVisitorData && channelIds.size() >= 3 ? channelIds.get(2) : null) |
| 443 | + getExtractorContentCountry()) |
466 | 444 | .value("continuation", continuation) |
467 | 445 | .done()) |
468 | 446 | .getBytes(StandardCharsets.UTF_8); |
|
0 commit comments