diff options
Diffstat (limited to 'repos')
| -rw-r--r-- | repos/jholodex.md | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/repos/jholodex.md b/repos/jholodex.md new file mode 100644 index 0000000..fb054b6 --- /dev/null +++ b/repos/jholodex.md @@ -0,0 +1,120 @@ +--- +title: JHolodex +lang: en-US +outline: deep +--- +Below is so mini-docs/examples for how to use JHolodex, a Java wrapper for the Holodex API. Its very heavily object oriented + +# JHolodex +[](https://github.com/pinapelz/JHolodex/actions/workflows/maven.yml) + + + +A Java wrapper for the [Holodex API](https://docs.holodex.net/#section/Holodex-API-Documentation). + +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 + + +### Maven +```xml +<dependency> + <groupId>com.pinapelz</groupId> + <artifactId>jholodex</artifactId> + <version>VERSION</version> +</dependency> +``` + +### Gradle + +```java +implementation group: 'com.pinapelz', name: 'jholodex', version: '1.4' +``` + +Alternatively use Jitpack for pre-releases + + + +## 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<Video> videos = holodex.getVideos(new VideoQueryBuilder().setChannelId("UCupmjRr7kPgzXKh-cPxxGbg") +.setStatus(Status.PAST).setLimit(5)); +for (Video video : videos) { + System.out.println(video.title + " - Currently: " + video.status); + System.out.println(video.start_scheduled); + System.out.println(video.id); +} +``` +Functions similarly to the above but contains the following [default parameters](https://docs.holodex.net/#/paths/~1live/get) +```java +List<SimpleVideo> videos = holodex.getLiveAndUpcomingVideos(new VideoQueryBuilder().setChannelId("UCupmjRr7kPgzXKh-cPxxGbg")); +for (SimpleVideo video : videos) { + System.out.println(video.title + " - Currently: " + video.status); +} +``` + +### Video Information +```java +Video video = holodex.getVideo(new VideoByVideoIdQueryBuilder().setVideoId("CN4_2sEx6vA")); +System.out.println(video.title); // HAPPY ONE YEAR OF ERINA!!! 🐯 +System.out.println(video.status); // past +System.out.println(video.published_at); // 2023-07-12T08:46:57.000Z +``` + +### List Channels +```java +List<Channel> phaseConnectChannels = holodex.getChannels(new ChannelQueryBuilder().setOrg(Organization.PHASE_CONNECT).setLimit(50)); +System.out.println(phaseConnectChannels.size()); // 26 +for (Channel channel : phaseConnectChannels) { + System.out.println(channel.name); +} +``` + +### Searching for Videos +```java +Object srv = holodex.searchVideo(new VideoSearchQueryBuilder().setSort("newest").setTopic(List.of("Music_Cover")). + setPaginated(true).setLimit(50)); +System.out.println(srv.getClass()); +List videos = ((VideoSearchResult) srv).items; +System.out.println(videos.size()); +for (Object video : videos) { + SimpleVideo vid = (SimpleVideo) video; + System.out.println(vid.title + vid.status); + System.out.println(vid.id); +} +``` + +### Searching Comments +```java +Object scr = holodex.searchComment(new CommentSearchQueryBuilder().setOrg(Organization.NIJISANJI). + setComment(List.of("cover", "cool")).setLimit(5).setPaginated(false)); +for (SimpleCommentVideo video : (List<SimpleCommentVideo>) scr) { + System.out.println(video.title + " - " + video.channel.name); + for (Comment comment : video.comments) { + System.out.println(" " + comment.message); + } +} +``` + |
