Fix parsing description for navigationEndpoint without urlEndpoint
This commit is contained in:
parent
26fb44595f
commit
729fd2eaee
|
@ -173,7 +173,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
@Override
|
||||
public Description getDescription() throws ParsingException {
|
||||
assertPageFetched();
|
||||
|
||||
// description with more info on links
|
||||
try {
|
||||
boolean htmlConversionRequired = false;
|
||||
|
@ -184,6 +183,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
String text = textHolder.getString("text");
|
||||
if (textHolder.getObject("navigationEndpoint") != null) {
|
||||
// The text is a link. Get the URL it points to and generate a HTML link of it
|
||||
if (textHolder.getObject("navigationEndpoint").getObject("urlEndpoint") != null) {
|
||||
String internUrl = textHolder.getObject("navigationEndpoint").getObject("urlEndpoint").getString("url");
|
||||
if (internUrl.startsWith("/redirect?")) {
|
||||
// q parameter can be the first parameter
|
||||
|
@ -204,10 +204,12 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
} else if (internUrl.startsWith("http")) {
|
||||
descriptionBuilder.append("<a href=\"").append(internUrl).append("\">").append(text).append("</a>");
|
||||
htmlConversionRequired = true;
|
||||
} else if (text != null) {
|
||||
descriptionBuilder.append(text);
|
||||
}
|
||||
} else if (text != null) {
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (text != null) {
|
||||
descriptionBuilder.append(text);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue