diff --git a/src/main/java/me/kavin/piped/utils/ResponseHelper.java b/src/main/java/me/kavin/piped/utils/ResponseHelper.java index 74f099f..00f4854 100644 --- a/src/main/java/me/kavin/piped/utils/ResponseHelper.java +++ b/src/main/java/me/kavin/piped/utils/ResponseHelper.java @@ -19,12 +19,14 @@ import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage; import org.schabi.newpipe.extractor.Page; import org.schabi.newpipe.extractor.channel.ChannelInfo; +import org.schabi.newpipe.extractor.channel.ChannelInfoItem; import org.schabi.newpipe.extractor.comments.CommentsInfo; import org.schabi.newpipe.extractor.comments.CommentsInfoItem; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.kiosk.KioskInfo; import org.schabi.newpipe.extractor.playlist.PlaylistInfo; +import org.schabi.newpipe.extractor.playlist.PlaylistInfoItem; import org.schabi.newpipe.extractor.search.SearchInfo; import org.schabi.newpipe.extractor.stream.StreamInfo; import org.schabi.newpipe.extractor.stream.StreamInfoItem; @@ -47,7 +49,9 @@ import me.kavin.piped.utils.obj.StreamItem; import me.kavin.piped.utils.obj.Streams; import me.kavin.piped.utils.obj.StreamsPage; import me.kavin.piped.utils.obj.Subtitle; +import me.kavin.piped.utils.obj.search.SearchChannel; import me.kavin.piped.utils.obj.search.SearchItem; +import me.kavin.piped.utils.obj.search.SearchPlaylist; import me.kavin.piped.utils.obj.search.SearchStream; public class ResponseHelper { @@ -316,11 +320,19 @@ public class ResponseHelper { StreamInfoItem stream = (StreamInfoItem) item; items.add(new SearchStream(item.getName(), rewriteURL(item.getThumbnailUrl()), item.getUrl().substring(23), stream.getTextualUploadDate(), stream.getUploaderName(), - stream.getUploaderUrl().substring(23), stream.getViewCount(), stream.getDuration())); + stream.getUploaderUrl().substring(23), stream.getViewCount(), stream.getDuration(), + stream.isUploaderVerified())); break; case CHANNEL: - items.add(new SearchItem(item.getName(), rewriteURL(item.getThumbnailUrl()), - item.getUrl().substring(23))); + ChannelInfoItem channel = (ChannelInfoItem) item; + items.add(new SearchChannel(item.getName(), rewriteURL(item.getThumbnailUrl()), + item.getUrl().substring(23), channel.getDescription(), channel.getSubscriberCount(), + channel.getStreamCount(), channel.isVerified())); + break; + case PLAYLIST: + PlaylistInfoItem playlist = (PlaylistInfoItem) item; + items.add(new SearchPlaylist(item.getName(), rewriteURL(item.getThumbnailUrl()), + item.getUrl().substring(23), playlist.getUploaderName(), playlist.getStreamCount())); break; default: break; @@ -349,11 +361,19 @@ public class ResponseHelper { StreamInfoItem stream = (StreamInfoItem) item; items.add(new SearchStream(item.getName(), rewriteURL(item.getThumbnailUrl()), item.getUrl().substring(23), stream.getTextualUploadDate(), stream.getUploaderName(), - stream.getUploaderUrl().substring(23), stream.getViewCount(), stream.getDuration())); + stream.getUploaderUrl().substring(23), stream.getViewCount(), stream.getDuration(), + stream.isUploaderVerified())); break; case CHANNEL: - items.add(new SearchItem(item.getName(), rewriteURL(item.getThumbnailUrl()), - item.getUrl().substring(23))); + ChannelInfoItem channel = (ChannelInfoItem) item; + items.add(new SearchChannel(item.getName(), rewriteURL(item.getThumbnailUrl()), + item.getUrl().substring(23), channel.getDescription(), channel.getSubscriberCount(), + channel.getStreamCount(), channel.isVerified())); + break; + case PLAYLIST: + PlaylistInfoItem playlist = (PlaylistInfoItem) item; + items.add(new SearchPlaylist(item.getName(), rewriteURL(item.getThumbnailUrl()), + item.getUrl().substring(23), playlist.getUploaderName(), playlist.getStreamCount())); break; default: break; diff --git a/src/main/java/me/kavin/piped/utils/obj/search/SearchChannel.java b/src/main/java/me/kavin/piped/utils/obj/search/SearchChannel.java new file mode 100644 index 0000000..102aac8 --- /dev/null +++ b/src/main/java/me/kavin/piped/utils/obj/search/SearchChannel.java @@ -0,0 +1,33 @@ +package me.kavin.piped.utils.obj.search; + +public class SearchChannel extends SearchItem { + + private String description; + private long subscribers, videos; + private boolean verified; + + public SearchChannel(String name, String thumbnail, String url, String description, long subscribers, long videos, + boolean verified) { + super(name, thumbnail, url); + this.description = description; + this.subscribers = subscribers; + this.videos = videos; + this.verified = verified; + } + + public String getDescription() { + return description; + } + + public long getSubscribers() { + return subscribers; + } + + public long getVideos() { + return videos; + } + + public boolean isVerified() { + return verified; + } +} diff --git a/src/main/java/me/kavin/piped/utils/obj/search/SearchPlaylist.java b/src/main/java/me/kavin/piped/utils/obj/search/SearchPlaylist.java new file mode 100644 index 0000000..6fe25b3 --- /dev/null +++ b/src/main/java/me/kavin/piped/utils/obj/search/SearchPlaylist.java @@ -0,0 +1,21 @@ +package me.kavin.piped.utils.obj.search; + +public class SearchPlaylist extends SearchItem { + + private String uploaderName; + private long videos; + + public SearchPlaylist(String name, String thumbnail, String url, String uploaderName, long videos) { + super(name, thumbnail, url); + this.uploaderName = uploaderName; + this.videos = videos; + } + + public String getUploaderName() { + return uploaderName; + } + + public long getVideos() { + return videos; + } +} diff --git a/src/main/java/me/kavin/piped/utils/obj/search/SearchStream.java b/src/main/java/me/kavin/piped/utils/obj/search/SearchStream.java index c2e59c8..09d5192 100644 --- a/src/main/java/me/kavin/piped/utils/obj/search/SearchStream.java +++ b/src/main/java/me/kavin/piped/utils/obj/search/SearchStream.java @@ -4,15 +4,17 @@ public class SearchStream extends SearchItem { private String uploadDate, uploader, uploaderUrl; private long views, duration; + private boolean uploaderVerified; public SearchStream(String name, String thumbnail, String url, String uploadDate, String uploader, - String uploaderUrl, long views, long duration) { + String uploaderUrl, long views, long duration, boolean uploaderVerified) { super(name, thumbnail, url); this.uploadDate = uploadDate; this.uploader = uploader; this.uploaderUrl = uploaderUrl; this.views = views; this.duration = duration; + this.uploaderVerified = uploaderVerified; } public String getUploadDate() { @@ -34,4 +36,8 @@ public class SearchStream extends SearchItem { public long getDuration() { return duration; } + + public boolean isUploaderVerified() { + return uploaderVerified; + } }