better quality thumbnails

This commit is contained in:
Ritvik Saraf 2018-09-03 00:11:40 +05:30
parent f62f147ea0
commit 9fb0622a24
3 changed files with 90 additions and 81 deletions

View File

@ -59,6 +59,12 @@ public class CommentsInfoItemsCollector extends InfoItemsCollector<CommentsInfoI
} catch (Exception e) {
addError(e);
}
try {
resultItem.setThumbnailUrl(extractor.getThumbnailUrl());
} catch (Exception e) {
addError(e);
}
return resultItem;
}

View File

@ -103,7 +103,7 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
@Override
public String getThumbnailUrl() throws ParsingException {
try {
return c.get("authorThumbnail").get("thumbnails").get(0).get("url").asText();
return c.get("authorThumbnail").get("thumbnails").get(2).get("url").asText();
} catch (Exception e) {
throw new ParsingException("Could not get thumbnail url", e);
}
@ -114,7 +114,7 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
try {
return c.get("authorText").get("simpleText").asText();
} catch (Exception e) {
throw new ParsingException("Could not get thumbnail url", e);
throw new ParsingException("Could not get author name", e);
}
}
@ -123,7 +123,7 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
try {
return c.get("publishedTimeText").get("runs").get(0).get("text").asText();
} catch (Exception e) {
throw new ParsingException("Could not get thumbnail url", e);
throw new ParsingException("Could not get publishedTimeText", e);
}
}
@ -132,7 +132,7 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
try {
return c.get("likeCount").intValue();
} catch (Exception e) {
throw new ParsingException("Could not get thumbnail url", e);
throw new ParsingException("Could not get like count", e);
}
}
@ -145,7 +145,7 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
return c.get("contentText").get("runs").get(0).get("text").asText();
}
} catch (Exception e) {
throw new ParsingException("Could not get thumbnail url", e);
throw new ParsingException("Could not get comment text", e);
}
}
@ -154,16 +154,16 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
try {
return c.get("commentId").asText();
} catch (Exception e) {
throw new ParsingException("Could not get thumbnail url", e);
throw new ParsingException("Could not get comment id", e);
}
}
@Override
public String getAuthorThumbnail() throws ParsingException {
try {
return c.get("authorThumbnail").get("thumbnails").get(0).get("url").asText();
return c.get("authorThumbnail").get("thumbnails").get(2).get("url").asText();
} catch (Exception e) {
throw new ParsingException("Could not get thumbnail url", e);
throw new ParsingException("Could not get author thumbnail", e);
}
}
@ -172,7 +172,7 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
try {
return c.get("authorText").get("simpleText").asText();
} catch (Exception e) {
throw new ParsingException("Could not get thumbnail url", e);
throw new ParsingException("Could not get author name", e);
}
}
@ -182,7 +182,7 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
return "https://youtube.com"
+ c.get("authorEndpoint").get("browseEndpoint").get("canonicalBaseUrl").asText();
} catch (Exception e) {
throw new ParsingException("Could not get thumbnail url", e);
throw new ParsingException("Could not get author endpoint", e);
}
}
};

View File

@ -1,19 +1,22 @@
package org.schabi.newpipe.extractor.stream;
import org.schabi.newpipe.extractor.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.schabi.newpipe.extractor.Info;
import org.schabi.newpipe.extractor.InfoItem;
import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.Subtitles;
import org.schabi.newpipe.extractor.comments.CommentsExtractor;
import org.schabi.newpipe.extractor.comments.CommentsInfo;
import org.schabi.newpipe.extractor.comments.CommentsInfoItem;
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.utils.DashMpdParser;
import org.schabi.newpipe.extractor.utils.ExtractorHelper;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/*
* Created by Christian Schabesberger on 26.08.15.
*