Add comments to the code
This commit is contained in:
parent
81459e289f
commit
ec778200d9
|
@ -122,7 +122,9 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
title = getTextFromObject(getVideoPrimaryInfoRenderer().getObject("title"));
|
title = getTextFromObject(getVideoPrimaryInfoRenderer().getObject("title"));
|
||||||
} catch (ParsingException ignored) { }
|
} catch (ParsingException ignored) {
|
||||||
|
// age-restricted videos cause a ParsingException here
|
||||||
|
}
|
||||||
|
|
||||||
if (isNullOrEmpty(title)) {
|
if (isNullOrEmpty(title)) {
|
||||||
title = playerResponse.getObject("videoDetails").getString("title");
|
title = playerResponse.getObject("videoDetails").getString("title");
|
||||||
|
@ -206,7 +208,9 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
try {
|
try {
|
||||||
String description = getTextFromObject(getVideoSecondaryInfoRenderer().getObject("description"), true);
|
String description = getTextFromObject(getVideoSecondaryInfoRenderer().getObject("description"), true);
|
||||||
if (description != null && !description.isEmpty()) return new Description(description, Description.HTML);
|
if (description != null && !description.isEmpty()) return new Description(description, Description.HTML);
|
||||||
} catch (ParsingException ignored) { }
|
} catch (ParsingException ignored) {
|
||||||
|
// age-restricted videos cause a ParsingException here
|
||||||
|
}
|
||||||
|
|
||||||
// raw non-html description
|
// raw non-html description
|
||||||
return new Description(playerResponse.getObject("videoDetails").getString("shortDescription"), Description.PLAIN_TEXT);
|
return new Description(playerResponse.getObject("videoDetails").getString("shortDescription"), Description.PLAIN_TEXT);
|
||||||
|
@ -260,7 +264,9 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
try {
|
try {
|
||||||
views = getTextFromObject(getVideoPrimaryInfoRenderer().getObject("viewCount")
|
views = getTextFromObject(getVideoPrimaryInfoRenderer().getObject("viewCount")
|
||||||
.getObject("videoViewCountRenderer").getObject("viewCount"));
|
.getObject("videoViewCountRenderer").getObject("viewCount"));
|
||||||
} catch (ParsingException ignored) {}
|
} catch (ParsingException ignored) {
|
||||||
|
// age-restricted videos cause a ParsingException here
|
||||||
|
}
|
||||||
|
|
||||||
if (isNullOrEmpty(views)) {
|
if (isNullOrEmpty(views)) {
|
||||||
views = playerResponse.getObject("videoDetails").getString("viewCount");
|
views = playerResponse.getObject("videoDetails").getString("viewCount");
|
||||||
|
@ -332,7 +338,9 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
if (!isNullOrEmpty(uploaderUrl)) {
|
if (!isNullOrEmpty(uploaderUrl)) {
|
||||||
return uploaderUrl;
|
return uploaderUrl;
|
||||||
}
|
}
|
||||||
} catch (ParsingException ignored) { }
|
} catch (ParsingException ignored) {
|
||||||
|
// age-restricted videos cause a ParsingException here
|
||||||
|
}
|
||||||
|
|
||||||
String uploaderId = playerResponse.getObject("videoDetails").getString("channelId");
|
String uploaderId = playerResponse.getObject("videoDetails").getString("channelId");
|
||||||
if (!isNullOrEmpty(uploaderId)) {
|
if (!isNullOrEmpty(uploaderId)) {
|
||||||
|
@ -373,7 +381,9 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
try {
|
try {
|
||||||
url = getVideoSecondaryInfoRenderer().getObject("owner").getObject("videoOwnerRenderer")
|
url = getVideoSecondaryInfoRenderer().getObject("owner").getObject("videoOwnerRenderer")
|
||||||
.getObject("thumbnail").getArray("thumbnails").getObject(0).getString("url");
|
.getObject("thumbnail").getArray("thumbnails").getObject(0).getString("url");
|
||||||
} catch (ParsingException ignored) { }
|
} catch (ParsingException ignored) {
|
||||||
|
// age-restricted videos cause a ParsingException here
|
||||||
|
}
|
||||||
|
|
||||||
if (isNullOrEmpty(url)) {
|
if (isNullOrEmpty(url)) {
|
||||||
if (ageLimit == 18) return "";
|
if (ageLimit == 18) return "";
|
||||||
|
|
Loading…
Reference in New Issue