mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-15 06:40:33 +05:30
Fix YoutubeStreamExtractor not being able to getAgeLimit() in onFetchPage()
This commit is contained in:
parent
bb3a3d70bf
commit
88282761f4
@ -260,7 +260,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAgeLimit() {
|
public int getAgeLimit() {
|
||||||
assertPageFetched();
|
if (initialData == null || initialData.isEmpty()) throw new IllegalStateException("initialData is not parsed yet");
|
||||||
if (initialData.getObject("contents").getObject("twoColumnWatchNextResults")
|
if (initialData.getObject("contents").getObject("twoColumnWatchNextResults")
|
||||||
.getObject("secondaryResults") == null) {
|
.getObject("secondaryResults") == null) {
|
||||||
return 18;
|
return 18;
|
||||||
@ -672,6 +672,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||||||
doc = YoutubeParsingHelper.parseAndCheckPage(verifiedUrl, response);
|
doc = YoutubeParsingHelper.parseAndCheckPage(verifiedUrl, response);
|
||||||
|
|
||||||
final String playerUrl;
|
final String playerUrl;
|
||||||
|
initialData = YoutubeParsingHelper.getInitialData(pageHtml);
|
||||||
// Check if the video is age restricted
|
// Check if the video is age restricted
|
||||||
if (getAgeLimit() == 18) {
|
if (getAgeLimit() == 18) {
|
||||||
final EmbeddedInfo info = getEmbeddedInfo();
|
final EmbeddedInfo info = getEmbeddedInfo();
|
||||||
@ -685,7 +686,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||||||
playerUrl = getPlayerUrl(ytPlayerConfig);
|
playerUrl = getPlayerUrl(ytPlayerConfig);
|
||||||
}
|
}
|
||||||
playerResponse = getPlayerResponse();
|
playerResponse = getPlayerResponse();
|
||||||
initialData = YoutubeParsingHelper.getInitialData(pageHtml);
|
|
||||||
|
|
||||||
if (decryptionCode.isEmpty()) {
|
if (decryptionCode.isEmpty()) {
|
||||||
decryptionCode = loadDecryptionCode(playerUrl);
|
decryptionCode = loadDecryptionCode(playerUrl);
|
||||||
|
Loading…
Reference in New Issue
Block a user