Stream: fix uploader avatar url

This commit is contained in:
TobiGr 2020-02-17 11:41:11 +01:00
parent be3e20e263
commit 7dcc9f159b
1 changed files with 5 additions and 3 deletions

View File

@ -476,9 +476,11 @@ public class YoutubeStreamExtractor extends StreamExtractor {
String uploaderAvatarUrl = null;
try {
uploaderAvatarUrl = doc.select("a[class*=\"yt-user-photo\"]").first()
.select("img").first()
.attr("abs:data-thumb");
uploaderAvatarUrl = ytInitialData.getObject("contents").getObject("twoColumnWatchNextResults").getObject("secondaryResults")
.getObject("secondaryResults").getArray("results").getObject(0).getObject("compactAutoplayRenderer")
.getArray("contents").getObject(0).getObject("compactVideoRenderer").getObject("channelThumbnail")
.getArray("thumbnails").getObject(0).getString("url");
} catch (Exception e) {//todo: add fallback method
throw new ParsingException("Could not get uploader avatar url", e);
}