[YouTube] Add signatureTimestamp argument to TVHTML5 client requests

This argument, which has been forgot, is required to get valid
streaming URLs with this client.
pull/1272/head
AudricV 2025-01-31 21:26:41 +01:00 zatwierdzone przez Stypox
rodzic 61f67854ed
commit 4644e1744b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4BDF1B40A49FDD23
2 zmienionych plików z 6 dodań i 2 usunięć
extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube

Wyświetl plik

@ -119,7 +119,8 @@ public final class YoutubeStreamHelper {
@Nonnull final Localization localization,
@Nonnull final ContentCountry contentCountry,
@Nonnull final String videoId,
@Nonnull final String cpn) throws IOException, ExtractionException {
@Nonnull final String cpn,
final int signatureTimestamp) throws IOException, ExtractionException {
final InnertubeClientRequestInfo innertubeClientRequestInfo =
new InnertubeClientRequestInfo(
new InnertubeClientRequestInfo.ClientInfo(
@ -154,6 +155,8 @@ public final class YoutubeStreamHelper {
addVideoIdCpnAndOkChecks(builder, videoId, cpn);
addPlaybackContext(builder, BASE_YT_DESKTOP_WATCH_URL + videoId, signatureTimestamp);
final byte[] body = JsonWriter.string(builder.done())
.getBytes(StandardCharsets.UTF_8);

Wyświetl plik

@ -941,7 +941,8 @@ public class YoutubeStreamExtractor extends StreamExtractor {
final JsonObject tvHtml5PlayerResponse =
YoutubeStreamHelper.getTvHtml5PlayerResponse(
localization, contentCountry, videoId, html5Cpn);
localization, contentCountry, videoId, html5Cpn,
YoutubeJavaScriptPlayerManager.getSignatureTimestamp(videoId));
if (isPlayerResponseNotValid(tvHtml5PlayerResponse, videoId)) {
throw new ExtractionException("TVHTML5 player response is not valid");