diff options
Diffstat (limited to 'src/main/java/App.java')
| -rw-r--r-- | src/main/java/App.java | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/main/java/App.java b/src/main/java/App.java index 6095c9b..1cc60d7 100644 --- a/src/main/java/App.java +++ b/src/main/java/App.java @@ -1,11 +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.VideoByVideoIdQueryBuilder; -import com.pina.query.VideoQueryBuilder; +import com.pina.datatypes.*; +import com.pina.query.*; import java.util.List; @@ -14,7 +10,7 @@ public class App public static void main( String[] args ) { try { - Holodex holodex = new Holodex("YOUR_API_KEY_HERE"); + 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"); @@ -34,6 +30,28 @@ public class App 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); + + // 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); + } + + + 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); } |
