mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2026-11-23 15:47:20 +00:00
[YouTube] Update NewPipeExtractor and adapt to removals
This commit is contained in:
1 parent
5779af87f8
commit
b4003d641e
3 files changed
+3
-23
No files matched your search
@@ -12,14 +12,9 @@ import static com.google.android.exoplayer2.upstream.DefaultHttpDataSource.DEFAU
|
||||
import static com.google.android.exoplayer2.upstream.HttpUtil.buildRangeRequestHeader;
|
||||
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
|
||||
import static com.google.android.exoplayer2.util.Util.castNonNull;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getAndroidUserAgent;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getIosUserAgent;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getVisionOsUserAgent;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isAndroidStreamingUrl;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isIosStreamingUrl;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isVisionOsStreamingUrl;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebStreamingUrl;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebEmbeddedPlayerStreamingUrl;
|
||||
import static java.lang.Math.min;
|
||||
|
||||
import android.net.Uri;
|
||||
@@ -661,8 +656,7 @@ public final class YoutubeHttpDataSource extends BaseDataSource implements HttpD
|
||||
}
|
||||
}
|
||||
|
||||
if (isWebStreamingUrl(requestUrl)
|
||||
|| isWebEmbeddedPlayerStreamingUrl(requestUrl)) {
|
||||
if (isWebStreamingUrl(requestUrl)) {
|
||||
httpURLConnection.setRequestProperty(HttpHeaders.ORIGIN, YOUTUBE_BASE_URL);
|
||||
httpURLConnection.setRequestProperty(HttpHeaders.REFERER, YOUTUBE_BASE_URL);
|
||||
httpURLConnection.setRequestProperty(HttpHeaders.SEC_FETCH_DEST, "empty");
|
||||
@@ -672,15 +666,7 @@ public final class YoutubeHttpDataSource extends BaseDataSource implements HttpD
|
||||
|
||||
httpURLConnection.setRequestProperty(HttpHeaders.TE, "trailers");
|
||||
|
||||
if (isAndroidStreamingUrl(requestUrl)) {
|
||||
// Improvement which may be done: find the content country used to request YouTube
|
||||
// contents to add it in the user agent instead of using the default
|
||||
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT,
|
||||
getAndroidUserAgent(null));
|
||||
} else if (isIosStreamingUrl(requestUrl)) {
|
||||
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT,
|
||||
getIosUserAgent(null));
|
||||
} else if (isVisionOsStreamingUrl(requestUrl)) {
|
||||
if (isVisionOsStreamingUrl(requestUrl)) {
|
||||
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT,
|
||||
getVisionOsUserAgent(null));
|
||||
} else {
|
||||
|
||||
@@ -123,10 +123,4 @@ object PoTokenProviderImpl : PoTokenProvider {
|
||||
|
||||
return PoTokenResult(visitorData, playerPot, streamingPot)
|
||||
}
|
||||
|
||||
override fun getWebEmbedClientPoToken(videoId: String): PoTokenResult? = null
|
||||
|
||||
override fun getAndroidClientPoToken(videoId: String): PoTokenResult? = null
|
||||
|
||||
override fun getIosClientPoToken(videoId: String): PoTokenResult? = null
|
||||
}
|
||||
@@ -73,7 +73,7 @@ teamnewpipe-nanojson = "e9d656ddb49a412a5a0a5d5ef20ca7ef09549996"
|
||||
# the corresponding commit hash, since JitPack sometimes deletes artifacts.
|
||||
# If there’s already a git hash, just add more of it to the end (or remove a letter)
|
||||
# to cause jitpack to regenerate the artifact.
|
||||
teamnewpipe-newpipe-extractor = "01fdde08af40f39f5736c921303218209bc9c13e"
|
||||
teamnewpipe-newpipe-extractor = "13a655fe53e0c3065f88725fc1fb594c3ede0169"
|
||||
viewpager2 = "1.1.0"
|
||||
webkit = "1.15.0" # New versions require minSdk 24
|
||||
work = "2.11.2"
|
||||
|
||||
Reference in new issue
Block a user