What is the easiest way to get reddit posts using JAVA for use in JDA?

fireworks on a train railway

I am trying to make a basic JDA bot, which posts embeds. I have the code for the JDA side of things done nicely with placeholders at the moment. What is the best approach to fetch the following information given a subreddit:

  • subreddit name
  • hot image post URL
  • hot image post title
  • direct imagepost url

I was considering either JSON with something like gson as that doesn’t require authentication, there are also some JAVA wrappers for the official API however these seem fairly dated and require a significant amount of setup.

Here is my JDA code:

image.setTitle("Funny Meme");
image.setFooter("Courtesy of r/SUBREDDIT");
image.addField("u200B", "> ***[POST TITLE](https://www.reddit.com/r/SUBREDDIT/POST/)***", false);
image.setImage("DIRECT IMAGE URL");

Does anyone have some basic reddit code as a starting point?


asked 7 hours ago

4653 silver badges14 bronze badges

Latest posts