|
14 | 14 | import static com.google.android.exoplayer2.util.Util.castNonNull; |
15 | 15 | import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getAndroidUserAgent; |
16 | 16 | import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getIosUserAgent; |
| 17 | +import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getVisionOsUserAgent; |
17 | 18 | import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isAndroidStreamingUrl; |
18 | 19 | import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isIosStreamingUrl; |
| 20 | +import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isVisionOsStreamingUrl; |
19 | 21 | import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebStreamingUrl; |
20 | 22 | import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebEmbeddedPlayerStreamingUrl; |
21 | 23 | import static java.lang.Math.min; |
@@ -670,16 +672,17 @@ private HttpURLConnection makeConnection( |
670 | 672 |
|
671 | 673 | httpURLConnection.setRequestProperty(HttpHeaders.TE, "trailers"); |
672 | 674 |
|
673 | | - final boolean isAndroidStreamingUrl = isAndroidStreamingUrl(requestUrl); |
674 | | - final boolean isIosStreamingUrl = isIosStreamingUrl(requestUrl); |
675 | | - if (isAndroidStreamingUrl) { |
| 675 | + if (isAndroidStreamingUrl(requestUrl)) { |
676 | 676 | // Improvement which may be done: find the content country used to request YouTube |
677 | 677 | // contents to add it in the user agent instead of using the default |
678 | 678 | httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT, |
679 | 679 | getAndroidUserAgent(null)); |
680 | | - } else if (isIosStreamingUrl) { |
| 680 | + } else if (isIosStreamingUrl(requestUrl)) { |
681 | 681 | httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT, |
682 | 682 | getIosUserAgent(null)); |
| 683 | + } else if (isVisionOsStreamingUrl(requestUrl)) { |
| 684 | + httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT, |
| 685 | + getVisionOsUserAgent(null)); |
683 | 686 | } else { |
684 | 687 | // non-mobile user agent |
685 | 688 | httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT, DownloaderImpl.USER_AGENT); |
|
0 commit comments