diff options
| author | Pinapelz <yukais6@uci.edu> | 2023-04-29 16:24:56 -0700 |
|---|---|---|
| committer | Pinapelz <yukais6@uci.edu> | 2023-04-29 16:24:56 -0700 |
| commit | 9684c18084458c26569fad4574657eaca046d2ec (patch) | |
| tree | e24d8827597004e2e0819ce333d34d5985cc20a1 /README.md | |
| parent | 9c13697880b7dcb35c5ecf541e639998925380eb (diff) | |
Added constant values to make filtering/sorting easier1.2
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 85 |
1 files changed, 52 insertions, 33 deletions
@@ -8,47 +8,66 @@ A mega scuffed Java Holodex Wrapper (Currently a work in progress). Supports the ## Usage Please check what values are available from your response through Holodex's API documentation. Null values indicate that the endpoint you are on does not serve the value you are trying to retrieve. ```java -Holodex holodex = new Holodex("YOUR_API_KEY"); -Channel channel = holodex.getChannel("UC4WvIIAo89_AzGUh1AZ6Dkg"); -System.out.println(channel.name + " is a member of " + channel.org + " and has " + channel.suborg + " as a suborg"); +import com.pinapelz.Holodex; +import com.pinapelz.HolodexException; +import com.pinapelz.datatypes.*; +import com.pinapelz.vtuber.*; +import com.pinapelz.query.*; -VideoQueryBuilder liveVideoQuery = new VideoQueryBuilder().setStatus("live").setOrg("Hololive"); -List<SimpleVideo> currentlyLiveVideos = holodex.getLiveAndUpcomingVideos(liveVideoQuery); -System.out.println("Currently there are " + currentlyLiveVideos.size() + " livestreams on going in Hololive"); +import java.util.List; -for (SimpleVideo video : currentlyLiveVideos) { -System.out.println(video.channel.name + " is currently live with " + video.live_viewers + " views"); -} +public class App { + public static void main(String[] args) { + try { + Holodex holodex = new Holodex("YOUR_API_KEY_HERE"); + Channel channel = holodex.getChannel("UC4WvIIAo89_AzGUh1AZ6Dkg"); + System.out.println(channel.name + " is a member of " + channel.org + " and has " + channel.suborg + " as a suborg"); -ChannelQueryBuilder channelQuery = new ChannelQueryBuilder(); -channelQuery.setOrg("Nijisanji"); -channelQuery.setLimit(75); -List<Channel> nijisanjiMembers = holodex.getChannels(channelQuery); + VideoQueryBuilder liveVideoQuery = new VideoQueryBuilder().setStatus(Status.LIVE).setOrg(Organization.HOLOLIVE); + List<SimpleVideo> currentlyLiveVideos = holodex.getLiveAndUpcomingVideos(liveVideoQuery); + System.out.println("Currently there are " + currentlyLiveVideos.size() + " livestreams on going in Hololive"); -Video anotherVideo = holodex.getVideo(new VideoByVideoIdQueryBuilder().setVideoId("9-O_IWM3184").setLang("en")); -System.out.println(anotherVideo.channel.name + " uploaded a video titled " + anotherVideo.title + -" on " + anotherVideo.published_at); + for (SimpleVideo video : currentlyLiveVideos) { + System.out.println(video.channel.name + " is currently live with " + video.live_viewers + " views"); + } -// SEARCHING THROUGH VIDEOS AND COMMENTS -Object srv = holodex.searchVideo(new VideoSearchQueryBuilder().setOrg(List.of("Nijisanji")).setSort("newest"). -setTarget(List.of("stream")).setPaginated(false).setLimit(10).setOffset(0) -.setTopic(List.of("singing")) -); -System.out.println("--- Search Results ---"); -for (SimpleVideo video : (List<SimpleVideo>) srv) { -System.out.println(video.title + " - " + video.channel.name); -} + ChannelQueryBuilder channelQuery = new ChannelQueryBuilder(); + channelQuery.setOrg(Organization.NIJISANJI); + channelQuery.setLimit(75); + List<Channel> nijisanjiMembers = holodex.getChannels(channelQuery); + + Video anotherVideo = holodex.getVideo(new VideoByVideoIdQueryBuilder().setVideoId("9-O_IWM3184").setLang(Language.ENGLISH)); + System.out.println(anotherVideo.channel.name + " uploaded a video titled " + anotherVideo.title + + " on " + anotherVideo.published_at); + // SEARCHING THROUGH VIDEOS AND COMMENTS + Object srv = holodex.searchVideo(new VideoSearchQueryBuilder().setOrg(List.of("Nijisanji")).setSort(Sort.NEWEST). + setTarget(List.of(Type.STREAM)).setPaginated(false).setLimit(10).setOffset(0) + .setTopic(List.of("singing")) + ); + System.out.println("--- Search Results ---"); + for (SimpleVideo video : (List<SimpleVideo>) srv) { + System.out.println(video.title + " - " + video.channel.name); + } -System.out.println("\n\n\nNow Searching Comments"); -String word = "Mumei"; -Object scr = holodex.searchComment(new CommentSearchQueryBuilder().setOrg(List.of("Hololive")).setComment(List.of(word)).setLimit(1).setPaginated(false)); -System.out.println("--- Search Results for comments containing kw: "+word+" ---"); -for (SimpleCommentVideo video : (List<SimpleCommentVideo>) scr) { -System.out.println(video.title + " - " + video.channel.name); -for (Comment comment : video.comments) { -System.out.println(" "+comment.message); + System.out.println("\n\n\nNow Searching Comments"); + String word = "Mumei"; + Object scr = holodex.searchComment(new CommentSearchQueryBuilder().setOrg(List.of("Hololive")).setComment(List.of(word)).setLimit(1).setPaginated(false)); + System.out.println("--- Search Results for comments containing kw: " + word + " ---"); + for (SimpleCommentVideo video : (List<SimpleCommentVideo>) scr) { + System.out.println(video.title + " - " + video.channel.name); + for (Comment comment : video.comments) { + System.out.println(" " + comment.message); + } + } + } catch (HolodexException ex) { + throw new RuntimeException(ex); + } + + + } } + ``` ## Download |
