Skip to content

fr31b3u73r/JodelAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JodelAPI

Implementation Java Donate

Important information: There has been made a change recently by Jodel which seems to have removed captcha verification. So generating new accounts with this API will currently result into error.

This is an inofficial library to interact with the private API of the Jodel App. Not affiliated with The Jodel Venture GmbH. API can change at any time so this library might not work in the future.

Usage

Have a look in the examples folder, the online documentation (Javadoc) and the source of the library.

It is mainly dependent on the Python Jodel API of nborrmann. There are some classes which contain helpers and parses to simplify interacting with the API. Please have a look into docs folder to find a full documentation.

Examples

Creating an account

To create a new account first add the library to your project. You can use the source or compile the source to a .jar file and add it to your project.

Add this line to the class you want to use the Jodel library:

import com.fr31b3u73r.jodel.*;

To create a new account use the constructor of class JodelAccount with your location. All other values will be set to null by default to simplify creating a new account.

JodelAccount ja = new JodelAccount("48.148434", "11.567867", "Munich", "DE", "Munich");

This is all you have to do, your account will then be set up. To retrieve your account data simply call getAccountData() which returns an object of type JodelAccountData with all needed information to use your account again later. For using your existing account data, just use one of the other constructors to pass values separately or as an JodelAccountData object. E.g.:

JodelAccountData myAccountData = new JodelAccountData();
myAccountData.accessToken = "your_access_token";
myAccountData.deviceUID = "your_device_uid";
myAccountData.distinctID = "your_distinct_uid";
myAccountData.expirationDate = "your_expiration_date";
myAccountData.refreshToken = "your_refresh_token";

JodelAccount myJodelAccount = new JodelAccount("48.148434", "11.567867", "Munich", "DE", "Munich", false, myAccountData);

Verify account

To be able to use most functions of your generated account you need to verify it. This is done by an image captcha. You can retrieve image url of this captcha and key simply by using the following function:

JodelRequestResponse captchaResponse = ja.getCaptchaData();
String captchaKey = captchaResponse.responseValues.get("captchaKey");
String captchaURL = captchaResponse.responseValues.get("captchaUrl");

To solve the captcha display the image and add the positions of images with a racoon to a list (starting from left to right beginning with 0).

Example:

List<Integer> positions = new ArrayList<Integer>();
positions.add(2);
positions.add(4);
positions.add(8);

To verify the captcha simply call verifyCaptcha with key and the list of positions:

JodelRequestResponse verifyCaptcha = ja.verifyCaptcha(captchaKey, positions);

Create a new Jodel

Creating a new Jodel with a verified account is simple. Just use createPost to do so:

JodelRequestResponse createResponse = ja.createPost("Ich bin eine Münchner Ampel", null, JodelPostColor.RED, null);

The first parameter is the message, in the second parameter you can pass a base64 encoded image, the third parameter is the color (as defined in Class JodelPostColor) and the last parameter defines the channel (use null if you don´t want to post to a chanel).

Retrieve Jodels

To retrieve Jodels from other users you can use one of the functions in JodelAccount:

  • getPostsRecent
  • getPostsPopular
  • getPostsDiscussed
  • getPicturesRecent
  • getPicturesPopular
  • getPicturesDiscussed
  • getMyPinnedPosts
  • getMyRepliedPosts
  • getMyVotedPosts

Have a look into source to see which parameters can be used calling those functions.

Here is an example:

JodelRequestResponse getPopularPictures = ja.getPicturesPopular(0, 10, null);

It gets the 10 most popular pictures of your current location. The response is of Type JodelRequestResponse. To parse this answer use the according parser as defined in "JodelParser":

List<JodelPost> retrievedPosts = JodelParser.getParsedJodels(getPopularPictures.rawResponseMessage);

There are also methods retrieving single Jodel posts, your norifications, recommended channels etc.. Have a look into source to see how to use them.

Mixed functions

Here are some functions that might also be interesting for you:

Follow a channel
JodelRequestResponse followChannel = ja.followChannel("selfies");
Unfollow a channel
JodelRequestResponse unfollowChannel = ja.unfollowChannel("selfies");
Upvote a Jodel
JodelRequestResponse upvoteJodel = ja.upvoteJodel("abc123");
Downvote a Jodel
JodelRequestResponse downvoteJodel = ja.downvoteJodel("abc123");
Get your current karma
JodelRequestResponse myKarma = ja.getKarma();
String karma = myKarma.responseValues.get("karma");

...and many more

Full documentation of public methods can be found in online documentation (Javadoc).

Feel free to commit changes and additions like missing methods, tests, docs etc.! If you encounter any problem don´t hesitate to open an issue - not all methods might be tested properly and bugs can occur at any time.

About

Unoffical Java Interface to the Jodel API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages