aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/App.java
diff options
context:
space:
mode:
authorPinapelz <donaldshan1@outlook.com>2023-04-06 11:08:29 -0700
committerPinapelz <donaldshan1@outlook.com>2023-04-06 11:08:29 -0700
commit070887400d5164ee623796240ad29da385a12a44 (patch)
tree4bb5c5003e269c95947fabff34de51fdd7a7508b /src/main/java/App.java
parentcaed3a3e490ea5fa98dfdd767b0fb26018e28348 (diff)
Refactored return objects, distinguished according to API
Video and Channels have been split into simple variations for cases when Holodex returns an object with less values
Diffstat (limited to 'src/main/java/App.java')
-rw-r--r--src/main/java/App.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/App.java b/src/main/java/App.java
index 1a21620..de0d268 100644
--- a/src/main/java/App.java
+++ b/src/main/java/App.java
@@ -1,6 +1,7 @@
import com.pina.Holodex;
import com.pina.HolodexException;
import com.pina.datatypes.Channel;
+import com.pina.datatypes.SimpleVideo;
import com.pina.datatypes.Video;
import com.pina.query.ChannelQueryBuilder;
import com.pina.query.VideoMetadataQueryBuilder;
@@ -13,14 +14,15 @@ public class App
public static void main( String[] args )
{
try {
- Holodex holodex = new Holodex("API_KEY"); //API key here is not active
+ Holodex holodex = new Holodex("5c9f2643-1762-40e8-85ab-b8e7d3e433a1");
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("live").setOrg("Hololive");
- List<Video> currentlyLiveVideos = holodex.getLiveVideos(liveVideoQuery);
+ List<SimpleVideo> currentlyLiveVideos = holodex.getLiveAndUpcomingVideos(liveVideoQuery);
System.out.println("Currently there are " + currentlyLiveVideos.size() + " livestreams on going in Hololive");
- for (Video video : currentlyLiveVideos) {
+
+ for (SimpleVideo video : currentlyLiveVideos) {
System.out.println(video.channel.name + " is currently live with " + video.live_viewers + " views");
}
@@ -28,16 +30,14 @@ public class App
channelQuery.setOrg("Nijisanji");
channelQuery.setLimit(75);
List<Channel> nijisanjiMembers = holodex.getChannels(channelQuery);
- // Gets the first 75 members of Nijisanji
- VideoMetadataQueryBuilder vidoeQuery = new VideoMetadataQueryBuilder();
- vidoeQuery.setVideoId("9-O_IWM3184");
Video anotherVideo = holodex.getVideo(new VideoMetadataQueryBuilder().setVideoId("9-O_IWM3184").setLang("en"));
- System.out.println(anotherVideo.channel.name + " uploaded a video titled " + anotherVideo.title + " on " + anotherVideo.published_at);
-
- }
- catch (HolodexException e) {
- e.printStackTrace();
+ System.out.println(anotherVideo.channel.name + " uploaded a video titled " + anotherVideo.title +
+ " on " + anotherVideo.published_at);
+ } catch (HolodexException ex) {
+ throw new RuntimeException(ex);
}
+
}
+
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage