From 6a7911864b2b71eddc61de5591d577ebe48e66b4 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sat, 15 Jul 2023 01:32:22 -0700 Subject: Update README.md - Added more examples --- README.md | 174 ++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 101 insertions(+), 73 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index b6fc683..b48bfa0 100644 --- a/README.md +++ b/README.md @@ -1,85 +1,26 @@ -# JHolodex -![GitHub release (latest by date)](https://img.shields.io/github/v/release/pinapelz/JHolodex) -[![](https://jitpack.io/v/pinapelz/JHolodex.svg)](https://jitpack.io/#pinapelz/JHolodex) +# JHolodex [![build](https://github.com/pinapelz/JHolodex/actions/workflows/maven.yml/badge.svg)](https://github.com/pinapelz/JHolodex/actions/workflows/maven.yml) -A mega scuffed Java Holodex Wrapper (Currently a work in progress). Supports the GET Requests from [Holodex API](https://holodex.stoplight.io/). Objects are used to build queries if more than one path or parameter is used for the given request. - -## 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. +A Java wrapper for the [Holodex API](https://docs.holodex.net/#section/Holodex-API-Documentation). -```java -import com.pinapelz.Holodex; -import com.pinapelz.HolodexException; -import com.pinapelz.datatypes.*; -import com.pinapelz.vtuber.*; -import com.pinapelz.query.*; - -import java.util.List; - -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"); - - VideoQueryBuilder liveVideoQuery = new VideoQueryBuilder().setStatus(Status.LIVE).setOrg(Organization.HOLOLIVE); - List currentlyLiveVideos = holodex.getLiveAndUpcomingVideos(liveVideoQuery); - System.out.println("Currently there are " + currentlyLiveVideos.size() + " livestreams on going in Hololive"); - - for (SimpleVideo video : currentlyLiveVideos) { - System.out.println(video.channel.name + " is currently live with " + video.live_viewers + " views"); - } - - ChannelQueryBuilder channelQuery = new ChannelQueryBuilder(); - channelQuery.setOrg(Organization.NIJISANJI); - channelQuery.setLimit(75); - - List nijisanjiMembers = holodex.getChannels(channelQuery); - - System.out.println("There are " + nijisanjiMembers.size() + " members in " + Organization.NIJISANJI); - - Video anotherVideo = holodex.getVideo(new VideoByVideoIdQueryBuilder().setVideoId("9-O_IWM3184").setLang( - List.of(Language.ENGLISH, Language.JAPANESE))); - - 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(Organization.NIJISANJI).setSort(Sort.NEWEST). - setTarget(Type.STREAM).setPaginated(false).setLimit(10).setOffset(0) - .setTopic(List.of("singing")) - ); - System.out.println("--- Search Results ---"); - for (SimpleVideo video : (List) srv) { - System.out.println(video.title + " - " + video.channel.name); - } - - System.out.println("\n\n\nNow Searching Comments"); - String word = "eating"; - Object scr = holodex.searchComment(new CommentSearchQueryBuilder().setOrg(Organization.NIJISANJI).setComment(List.of(word)).setLimit(1).setPaginated(false)); - System.out.println("--- Search Results for comments containing kw: " + word + " ---"); - for (SimpleCommentVideo video : (List) 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); - } +All GET and POST requests are supported and is modelled after the Holodex API. +Please check the [Holodex API](https://holodex.stoplight.io/) for more information regarding the specifications - } -} -``` +[Holodex License](https://docs.holodex.net/#section/LICENSE) ## Download ![](https://img.shields.io/github/v/release/pinapelz/JHolodex) [![](https://jitpack.io/v/pinapelz/JHolodex.svg)](https://jitpack.io/#pinapelz/JHolodex) ### Maven ```xml + + + jitpack.io + https://jitpack.io + + + com.github.pinapelz JHolodex @@ -88,10 +29,97 @@ public class App { ``` ### Gradle -```gradle +```java +allprojects { + repositories { + ... + maven { url 'https://jitpack.io' } + } +} + dependencies { implementation 'com.github.pinapelz:JHolodex:Tag' } ``` #### Add [JitPack](https://jitpack.io/) to your list of repositories -#### [Holodex License](https://docs.holodex.net/docs/holodex/8166fcec5dbe2-license) + + + +## Getting Started +Please check what values are available at each endpoint through the [Holodex API Documentation](https://docs.holodex.net/#section/Holodex-API-Documentation). + +The use of enums is optional, you can always pass in Strings as parameters as they appear on Holodex + +The following are some example use cases to get you started. +### Channel Information +```java +Holodex holodex = new Holodex("YOUR_API_KEY_HERE"); +Channel channel = holodex.getChannel("UCupmjRr7kPgzXKh-cPxxGbg"); +System.out.println(channel.name); // Erina Ch. エリナ・マキナ 【Phase Connect】 +System.out.println(channel.english_name); // Erina Makina # This provides an English or localized name if available +System.out.println(channel.type); // vtuber +System.out.println(channel.subscriber_count); // 28500 +``` + +### Live and Upcoming Videos +Queries the videos for a particular channel +```java +List