diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/PeertubeParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/PeertubeParsingHelper.java index ad11e6b39..4e8bd2d35 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/PeertubeParsingHelper.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/PeertubeParsingHelper.java @@ -22,6 +22,7 @@ import java.time.Instant; import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.time.format.DateTimeParseException; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -198,6 +199,47 @@ public final class PeertubeParsingHelper { "banners", "banner"); } + /** + * Get thumbnails from a playlist or a video item {@link JsonObject}. + * + *
+ * PeerTube provides two thumbnails in its API: a low one, represented by the value of the + * {@code thumbnailPath} key, and a medium one, represented by the value of the + * {@code previewPath} key. + *
+ * + *+ * If a value is not null or empty, an {@link Image} will be added to the list returned with + * the URL to the thumbnail ({@code baseUrl + value}), a height and a width unknown and the + * corresponding resolution level (see above). + *
+ * + * @param baseUrl the base URL of the PeerTube instance + * @param playlistOrVideoItemObject the playlist or the video item {@link JsonObject}, which + * must not be null + * @return an unmodifiable list of {@link Image}s, which is never null but can be empty + */ + @Nonnull + public static List