Skip to content

Commit ac654a7

Browse files
authored
Merge pull request #1438 from AudricV/yt_fix-page-reload-required-streams
2 parents a88b50e + ed48df2 commit ac654a7

471 files changed

Lines changed: 51947 additions & 38949 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/ClientsConstants.java

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,19 @@ private ClientsConstants() {
1919
* The client version for InnerTube requests with the {@code WEB} client, used as the last
2020
* fallback if the extraction of the real one failed.
2121
*/
22-
static final String WEB_HARDCODED_CLIENT_VERSION = "2.20250122.04.00";
22+
static final String WEB_HARDCODED_CLIENT_VERSION = "2.20260120.01.00";
2323

2424
// WEB_REMIX (YouTube Music) client fields
2525

2626
static final String WEB_REMIX_CLIENT_ID = "67";
2727
static final String WEB_REMIX_CLIENT_NAME = "WEB_REMIX";
28-
static final String WEB_REMIX_HARDCODED_CLIENT_VERSION = "1.20250122.01.00";
29-
30-
// TVHTML5 (YouTube on TVs and consoles using HTML5) client fields
31-
static final String TVHTML5_CLIENT_ID = "7";
32-
static final String TVHTML5_CLIENT_NAME = "TVHTML5";
33-
static final String TVHTML5_CLIENT_VERSION = "7.20250122.15.00";
34-
static final String TVHTML5_CLIENT_PLATFORM = "GAME_CONSOLE";
35-
static final String TVHTML5_DEVICE_MAKE = "Sony";
36-
static final String TVHTML5_DEVICE_MODEL_AND_OS_NAME = "PlayStation 4";
37-
// CHECKSTYLE:OFF
38-
static final String TVHTML5_USER_AGENT =
39-
"Mozilla/5.0 (PlayStation; PlayStation 4/12.00) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15";
40-
// CHECKSTYLE:ON
28+
static final String WEB_REMIX_HARDCODED_CLIENT_VERSION = "1.20260121.03.00";
4129

4230
// WEB_EMBEDDED_PLAYER (YouTube embeds)
4331

4432
static final String WEB_EMBEDDED_CLIENT_ID = "56";
4533
static final String WEB_EMBEDDED_CLIENT_NAME = "WEB_EMBEDDED_PLAYER";
46-
static final String WEB_EMBEDDED_CLIENT_VERSION = "1.20250121.00.00";
34+
static final String WEB_EMBEDDED_CLIENT_VERSION = "1.20260122.01.00";
4735

4836
// WEB_MUSIC_ANALYTICS (YouTube charts)
4937

@@ -61,11 +49,11 @@ private ClientsConstants() {
6149
*
6250
* <p>
6351
* It can be extracted by getting the latest release version of the app on
64-
* <a href="https://apps.apple.com/us/app/youtube-watch-listen-stream/id544007664/">the App
52+
* <a href="https://apps.apple.com/us/app/youtube/id544007664">the App
6553
* Store page of the YouTube app</a>, in the {@code What’s New} section.
6654
* </p>
6755
*/
68-
static final String IOS_CLIENT_VERSION = "20.03.02";
56+
static final String IOS_CLIENT_VERSION = "21.03.2";
6957

7058
/**
7159
* The device machine id for the iPhone 15 Pro Max, used to get 60fps with the {@code iOS}
@@ -93,7 +81,7 @@ private ClientsConstants() {
9381
*
9482
* @see #IOS_USER_AGENT_VERSION
9583
*/
96-
static final String IOS_OS_VERSION = "18.2.1.22C161";
84+
static final String IOS_OS_VERSION = "18.7.2.22H124";
9785

9886
/**
9987
* The iOS version to be used in the HTTP user agent for requests.
@@ -104,7 +92,7 @@ private ClientsConstants() {
10492
*
10593
* @see #IOS_OS_VERSION
10694
*/
107-
static final String IOS_USER_AGENT_VERSION = "18_2_1";
95+
static final String IOS_USER_AGENT_VERSION = "18_7_2";
10896

10997
// ANDROID (Android YouTube app) client fields
11098

@@ -120,5 +108,5 @@ private ClientsConstants() {
120108
* such as <a href="https://www.apkmirror.com/apk/google-inc/youtube/">APKMirror</a>.
121109
* </p>
122110
*/
123-
static final String ANDROID_CLIENT_VERSION = "19.28.35";
111+
static final String ANDROID_CLIENT_VERSION = "21.03.36";
124112
}

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/InnertubeClientRequestInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public static InnertubeClientRequestInfo ofAndroidClient() {
131131
new InnertubeClientRequestInfo.ClientInfo(ANDROID_CLIENT_NAME,
132132
ANDROID_CLIENT_VERSION, ANDROID_CLIENT_ID, WATCH_CLIENT_SCREEN, null),
133133
new InnertubeClientRequestInfo.DeviceInfo(MOBILE_CLIENT_PLATFORM, null, null,
134-
"Android", "15", 35));
134+
"Android", "16", 36));
135135
}
136136

137137
@Nonnull

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import static org.schabi.newpipe.extractor.services.youtube.ClientsConstants.IOS_CLIENT_VERSION;
2727
import static org.schabi.newpipe.extractor.services.youtube.ClientsConstants.IOS_DEVICE_MODEL;
2828
import static org.schabi.newpipe.extractor.services.youtube.ClientsConstants.IOS_USER_AGENT_VERSION;
29-
import static org.schabi.newpipe.extractor.services.youtube.ClientsConstants.TVHTML5_USER_AGENT;
3029
import static org.schabi.newpipe.extractor.services.youtube.ClientsConstants.WEB_CLIENT_ID;
3130
import static org.schabi.newpipe.extractor.services.youtube.ClientsConstants.WEB_CLIENT_NAME;
3231
import static org.schabi.newpipe.extractor.services.youtube.ClientsConstants.WEB_HARDCODED_CLIENT_VERSION;
@@ -178,8 +177,6 @@ private YoutubeParsingHelper() {
178177
private static final Pattern C_WEB_PATTERN = Pattern.compile("&c=WEB");
179178
private static final Pattern C_WEB_EMBEDDED_PLAYER_PATTERN =
180179
Pattern.compile("&c=WEB_EMBEDDED_PLAYER");
181-
private static final Pattern C_TVHTML5_PLAYER_PATTERN =
182-
Pattern.compile("&c=TVHTML5");
183180
private static final Pattern C_ANDROID_PATTERN = Pattern.compile("&c=ANDROID");
184181
private static final Pattern C_IOS_PATTERN = Pattern.compile("&c=IOS");
185182

@@ -1118,17 +1115,6 @@ public static String getIosUserAgent(@Nullable final Localization localization)
11181115
+ ")";
11191116
}
11201117

1121-
/**
1122-
* Get the user-agent string used as the user-agent for InnerTube requests with the HTML5 TV
1123-
* client.
1124-
*
1125-
* @return the user-agent used for InnerTube requests with the TVHTML5 client
1126-
*/
1127-
@Nonnull
1128-
public static String getTvHtml5UserAgent() {
1129-
return TVHTML5_USER_AGENT;
1130-
}
1131-
11321118
/**
11331119
* Returns a {@link Map} containing the required YouTube Music headers.
11341120
*/
@@ -1384,17 +1370,6 @@ public static boolean isWebEmbeddedPlayerStreamingUrl(@Nonnull final String url)
13841370
return Parser.isMatch(C_WEB_EMBEDDED_PLAYER_PATTERN, url);
13851371
}
13861372

1387-
/**
1388-
* Check if the streaming URL is a URL from the YouTube {@code TVHTML5} client.
1389-
*
1390-
* @param url the streaming URL on which check if it's a {@code TVHTML5}
1391-
* streaming URL.
1392-
* @return true if it's a {@code TVHTML5} streaming URL, false otherwise
1393-
*/
1394-
public static boolean isTvHtml5StreamingUrl(@Nonnull final String url) {
1395-
return Parser.isMatch(C_TVHTML5_PLAYER_PATTERN, url);
1396-
}
1397-
13981373
/**
13991374
* Check if the streaming URL is a URL from the YouTube {@code ANDROID} client.
14001375
*

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static JsonObject getWebMetadataPlayerResponse(
7272
.getBytes(StandardCharsets.UTF_8);
7373

7474
final String url = YOUTUBEI_V1_URL + PLAYER + "?" + DISABLE_PRETTY_PRINT_PARAMETER
75-
+ "&$fields=microformat,playabilityStatus,storyboards,videoDetails";
75+
+ "&$fields=microformat,videoDetails.thumbnail.thumbnails,videoDetails.videoId";
7676

7777
return JsonUtils.toJsonObject(getValidJsonResponseBody(
7878
getDownloader().postWithContentTypeJson(

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/dashmanifestcreators/YoutubeDashManifestCreatorsUtils.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getAndroidUserAgent;
44
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getIosUserAgent;
55
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getOriginReferrerHeaders;
6-
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getTvHtml5UserAgent;
76
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isAndroidStreamingUrl;
87
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isIosStreamingUrl;
9-
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isTvHtml5StreamingUrl;
108
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebStreamingUrl;
119
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebEmbeddedPlayerStreamingUrl;
1210
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
@@ -604,9 +602,7 @@ public static Response getInitializationResponse(@Nonnull String baseStreamingUr
604602
@Nonnull final ItagItem itagItem,
605603
final DeliveryType deliveryType)
606604
throws CreationException {
607-
final boolean isTvHtml5StreamingUrl = isTvHtml5StreamingUrl(baseStreamingUrl);
608605
final boolean isHtml5StreamingUrl = isWebStreamingUrl(baseStreamingUrl)
609-
|| isTvHtml5StreamingUrl
610606
|| isWebEmbeddedPlayerStreamingUrl(baseStreamingUrl);
611607
final boolean isAndroidStreamingUrl = isAndroidStreamingUrl(baseStreamingUrl);
612608
final boolean isIosStreamingUrl = isIosStreamingUrl(baseStreamingUrl);
@@ -620,7 +616,7 @@ public static Response getInitializationResponse(@Nonnull String baseStreamingUr
620616
final String mimeTypeExpected = itagItem.getMediaFormat().getMimeType();
621617
if (!isNullOrEmpty(mimeTypeExpected)) {
622618
return getStreamingWebUrlWithoutRedirects(downloader, baseStreamingUrl,
623-
mimeTypeExpected, isTvHtml5StreamingUrl);
619+
mimeTypeExpected);
624620
}
625621
} else if (isAndroidStreamingUrl || isIosStreamingUrl) {
626622
try {
@@ -735,8 +731,6 @@ private static String appendRnSqParamsIfNeeded(@Nonnull final String baseStreami
735731
* @param downloader the {@link Downloader} instance to be used
736732
* @param streamingUrl the streaming URL which we are trying to get a streaming URL
737733
* without any redirection on the network and/or IP used
738-
* @param isTvHtml5StreamingUrl whether the streaming URL comes from TVHTML5 client, in
739-
* order to use an appropriate HTTP User-Agent header
740734
* @param responseMimeTypeExpected the response mime type expected from Google video servers
741735
* @return the {@link Response} of the stream, which should have no redirections
742736
*/
@@ -745,15 +739,11 @@ private static String appendRnSqParamsIfNeeded(@Nonnull final String baseStreami
745739
private static Response getStreamingWebUrlWithoutRedirects(
746740
@Nonnull final Downloader downloader,
747741
@Nonnull String streamingUrl,
748-
@Nonnull final String responseMimeTypeExpected,
749-
final boolean isTvHtml5StreamingUrl)
742+
@Nonnull final String responseMimeTypeExpected)
750743
throws CreationException {
751744
try {
752745
final var headers = new HashMap<>(
753746
getOriginReferrerHeaders("https://www.youtube.com"));
754-
if (isTvHtml5StreamingUrl) {
755-
headers.put("User-Agent", List.of(getTvHtml5UserAgent()));
756-
}
757747

758748
String responseMimeType = "";
759749

0 commit comments

Comments
 (0)