You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.1 KiB

package sh.adb.RandomRedditMemesAPI;
import com.github.jreddit.oauth.RedditOAuthAgent;
import com.github.jreddit.oauth.RedditToken;
import com.github.jreddit.oauth.app.RedditApp;
import com.github.jreddit.oauth.app.RedditInstalledApp;
import com.github.jreddit.oauth.exception.RedditOAuthException;
import com.sun.net.httpserver.HttpServer;
import org.json.simple.parser.ParseException;
import java.io.IOException;
import java.net.InetSocketAddress;
public class Main {
public static void main(String[] args) throws IOException, RedditOAuthException, ParseException {
HttpServer server = HttpServer.create(new InetSocketAddress(8000), 0);
server.createContext("/", new FallbackHandler());
//server.createContext("/api/v1/", new StandardHandler());
server.createContext("/api/v1/r/", new CommunityHandler());
server.setExecutor(null);
server.start();
System.out.println("server started");
RedditAPI client = new RedditAPI();
System.out.println("the token is");
System.out.println(client.token.getAccessToken());
}
}