[YouTube] Add check for channel items without description in search

This commit is contained in:
Mauricio Colli 2020-03-21 03:15:51 -03:00
parent 9b7999fe54
commit b7f8001a49
No known key found for this signature in database
GPG Key ID: F200BFD6F29DDD85

View File

@ -95,7 +95,14 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor
@Override
public String getDescription() throws ParsingException {
try {
return getTextFromObject(channelInfoItem.getObject("descriptionSnippet"));
final JsonObject descriptionObject = channelInfoItem.getObject("descriptionSnippet");
if (descriptionObject == null) {
// Channel have no description.
return null;
}
return getTextFromObject(descriptionObject);
} catch (Exception e) {
throw new ParsingException("Could not get description", e);
}