[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
1 changed files with 8 additions and 1 deletions

View File

@ -95,7 +95,14 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor
@Override @Override
public String getDescription() throws ParsingException { public String getDescription() throws ParsingException {
try { 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) { } catch (Exception e) {
throw new ParsingException("Could not get description", e); throw new ParsingException("Could not get description", e);
} }