[YouTube] Adapt YoutubeHttpDataSource to TVHTML5 client removal in NPE
This commit is contained in:
parent
6d2b14fb28
commit
a7ce0765ea
1 changed files with 0 additions and 8 deletions
|
|
@ -14,10 +14,8 @@ import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
|
||||||
import static com.google.android.exoplayer2.util.Util.castNonNull;
|
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.getAndroidUserAgent;
|
||||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getIosUserAgent;
|
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getIosUserAgent;
|
||||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getTvHtml5UserAgent;
|
|
||||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isAndroidStreamingUrl;
|
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.isIosStreamingUrl;
|
||||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isTvHtml5StreamingUrl;
|
|
||||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebStreamingUrl;
|
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebStreamingUrl;
|
||||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebEmbeddedPlayerStreamingUrl;
|
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebEmbeddedPlayerStreamingUrl;
|
||||||
import static java.lang.Math.min;
|
import static java.lang.Math.min;
|
||||||
|
|
@ -661,10 +659,7 @@ public final class YoutubeHttpDataSource extends BaseDataSource implements HttpD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean isTvHtml5StreamingUrl = isTvHtml5StreamingUrl(requestUrl);
|
|
||||||
|
|
||||||
if (isWebStreamingUrl(requestUrl)
|
if (isWebStreamingUrl(requestUrl)
|
||||||
|| isTvHtml5StreamingUrl
|
|
||||||
|| isWebEmbeddedPlayerStreamingUrl(requestUrl)) {
|
|| isWebEmbeddedPlayerStreamingUrl(requestUrl)) {
|
||||||
httpURLConnection.setRequestProperty(HttpHeaders.ORIGIN, YOUTUBE_BASE_URL);
|
httpURLConnection.setRequestProperty(HttpHeaders.ORIGIN, YOUTUBE_BASE_URL);
|
||||||
httpURLConnection.setRequestProperty(HttpHeaders.REFERER, YOUTUBE_BASE_URL);
|
httpURLConnection.setRequestProperty(HttpHeaders.REFERER, YOUTUBE_BASE_URL);
|
||||||
|
|
@ -685,9 +680,6 @@ public final class YoutubeHttpDataSource extends BaseDataSource implements HttpD
|
||||||
} else if (isIosStreamingUrl) {
|
} else if (isIosStreamingUrl) {
|
||||||
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT,
|
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT,
|
||||||
getIosUserAgent(null));
|
getIosUserAgent(null));
|
||||||
} else if (isTvHtml5StreamingUrl) {
|
|
||||||
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT,
|
|
||||||
getTvHtml5UserAgent());
|
|
||||||
} else {
|
} else {
|
||||||
// non-mobile user agent
|
// non-mobile user agent
|
||||||
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT, DownloaderImpl.USER_AGENT);
|
httpURLConnection.setRequestProperty(HttpHeaders.USER_AGENT, DownloaderImpl.USER_AGENT);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue