diff options
| author | Pinapelz <donaldshan1@outlook.com> | 2023-04-04 23:38:56 -0700 |
|---|---|---|
| committer | Pinapelz <donaldshan1@outlook.com> | 2023-04-04 23:38:56 -0700 |
| commit | 36d10af196665454101859a49023dd5d7dad8622 (patch) | |
| tree | e50aef7f945a6690b43bed7d6315af3adff2072f /src | |
| parent | aa70fe1417c22383b8a88374288947362f0c6d48 (diff) | |
Updated demo code
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/java/App.java | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/src/main/java/App.java b/src/main/java/App.java index ce2dc80..59002ac 100644 --- a/src/main/java/App.java +++ b/src/main/java/App.java @@ -1,7 +1,9 @@ import com.pina.Holodex; import com.pina.HolodexException; +import com.pina.datatypes.Channel; import com.pina.datatypes.Video; -import com.pina.query.LiveStreamsQueryBuilder; +import com.pina.query.ChannelQueryBuilder; +import com.pina.query.LiveVideoQueryBuilder; import java.util.List; @@ -11,15 +13,33 @@ public class App { Holodex holodex = new Holodex(); try { - LiveStreamsQueryBuilder query = new LiveStreamsQueryBuilder(); - query.setStatus("live"); - query.setOrg("WACTOR"); - List<Video> videos = holodex.getLiveStreams(query); - for (Video stream : videos) { - System.out.println(stream.title + " is live with " + stream.live_viewers + " viewers " + stream.id); + ChannelQueryBuilder query = new ChannelQueryBuilder(); + query.setOrg("Hololive"); + List<Channel> channels = holodex.getChannels(query); + System.out.println("The Members of Hololive are:"); + for (Channel channel : channels) { + System.out.println(channel.name + " (" + channel.id + ")"); } + System.out.println("\n"); + Channel channel = holodex.getChannel("UC1DCedRgGHBdm81E1llLhOQ"); + System.out.println(channel.name+"'s English name is " + channel.english_name); + System.out.println(channel.name+" is a "+channel.type); + + LiveVideoQueryBuilder liveQuery = new LiveVideoQueryBuilder(); + liveQuery.setChannelId("UCkngxfPbmGyGl_RIq4FA3MQ"); + liveQuery.setStatus("upcoming"); + List<Video> chigusaUpcoming = holodex.getVideos(liveQuery); + System.out.println("\n"); + System.out.println("Chigusa's upcoming streams are:"); + for (Video video : chigusaUpcoming) { + System.out.println(video.title + " (" + video.id + ")"); + } + + + } catch (HolodexException e) { System.err.println("Failed to get live streams: " + e.getMessage()); } + System.exit(0); } } |
