Giter VIP home page Giter VIP logo

jreddit's Introduction

jReddit (forked from hormigas/jReddit)

What is jReddit?

jReddit is a wrapper for the Reddit API written in Java. 
It is a work in progress.

What can it do?

So far, jReddit can login with a user, retrieve user information, 
submit new links, and vote/comment on submissions, among other things.

What's next for jReddit?

The original project (hormigas/jReddit) wants to implement every feature 
documented [here](http://www.reddit.com/dev/api).

This fork is to improve on the original object model
and add functionality.

Dependencies

JSON-simple

Building (everything)

$ ant all

See ant targets in build.xml for additional targets.

E.g.
$ ant examples

Building and Running Examples

Compile
$ ant examples

Running usage:
$ examples/runExample.sh <classname> <user> <pass> <subreddit> 

E.g.
$ examples/runExample.sh TopCommentLister joesmith secret123 pics

Examples

import com.omrlnr.jreddit.submissions.Submission;
import com.omrlnr.jreddit.submissions.Submissions;
import com.omrlnr.jreddit.user.User;

import com.omrlnr.jreddit.utils.Utils;

import java.util.List;

/**
 *
 * A simple example that lists submissions in a subreddit
 * 
 */
public class SubmissionLister {

    public static void main(String[] args) throws Exception {

        String username     = args[0];
        String password     = args[1];
        String subreddit    = args[2];

        Utils.setUserAgent("Sample Java API user agent v0.01");

        User user = new User(username, password);
        user.connect();
    
        List<Submission> submissions = Submissions.getSubmissions(
                                            subreddit,
                                            Submissions.NEW,
                                            Submissions.FRONTPAGE,
                                            user);

        for(Submission submission: submissions) {
            System.out.println(submission);
        }
    }

}

jreddit's People

Contributors

hormigas avatar jasonsimpson avatar naduse avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.