Skip to content

Commit 84d7db5

Browse files
authored
Merge pull request #13591 from AudricV/yt_support_properly_sabr_workaround
[YouTube] Support properly new client which works around SABR enforcement
2 parents 1058370 + 058810f commit 84d7db5

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/datasource/YoutubeHttpDataSource.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
import static com.google.android.exoplayer2.util.Util.castNonNull;
1515
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getAndroidUserAgent;
1616
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getIosUserAgent;
17+
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getVisionOsUserAgent;
1718
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isAndroidStreamingUrl;
1819
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isIosStreamingUrl;
20+
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isVisionOsStreamingUrl;
1921
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebStreamingUrl;
2022
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebEmbeddedPlayerStreamingUrl;
2123
import static java.lang.Math.min;
@@ -670,16 +672,17 @@ private HttpURLConnection makeConnection(
670672

671673
httpURLConnection.setRequestProperty(HttpHeaders.TE, "trailers");
672674

673-
final boolean isAndroidStreamingUrl = isAndroidStreamingUrl(requestUrl);
674-
final boolean isIosStreamingUrl = isIosStreamingUrl(requestUrl);
675-
if (isAndroidStreamingUrl) {
675+
if (isAndroidStreamingUrl(requestUrl)) {
676676
// Improvement which may be done: find the content country used to request YouTube
677677
// contents to add it in the user agent instead of using the default
678678
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT,
679679
getAndroidUserAgent(null));
680-
} else if (isIosStreamingUrl) {
680+
} else if (isIosStreamingUrl(requestUrl)) {
681681
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT,
682682
getIosUserAgent(null));
683+
} else if (isVisionOsStreamingUrl(requestUrl)) {
684+
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT,
685+
getVisionOsUserAgent(null));
683686
} else {
684687
// non-mobile user agent
685688
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT, DownloaderImpl.USER_AGENT);

0 commit comments

Comments
 (0)