[StreamExtractor] Add fallback method for uploader avatar url

This commit is contained in:
TobiGr 2020-02-18 13:05:11 +01:00
parent 3ec422a542
commit 12166ca60c

View File

@ -479,8 +479,17 @@ public class YoutubeStreamExtractor extends StreamExtractor {
.getObject("secondaryResults").getArray("results").getObject(0).getObject("compactAutoplayRenderer")
.getArray("contents").getObject(0).getObject("compactVideoRenderer").getObject("channelThumbnail")
.getArray("thumbnails").getObject(0).getString("url");
if (uploaderAvatarUrl != null && !uploaderAvatarUrl.isEmpty()) {
return uploaderAvatarUrl;
}
} catch (Exception ignored) {}
} catch (Exception e) {//todo: add fallback method
try {
uploaderAvatarUrl = ytInitialData.getObject("contents").getObject("twoColumnWatchNextResults").getObject("results")
.getObject("results").getArray("contents").getObject(1).getObject("videoSecondaryInfoRenderer")
.getObject("owner").getObject("videoOwnerRenderer").getObject("thumbnail").getArray("thumbnails")
.getObject(0).getString("url");
} catch (Exception e) {
throw new ParsingException("Could not get uploader avatar url", e);
}