Skip to content

Parses/requests the daily reward page from rewards.hypixel.net

License

Notifications You must be signed in to change notification settings

ipsvn/daily-reward-parse-util

Repository files navigation

daily-reward-parse-util

Parses the Hypixel daily reward website into a basic Java API

Download

Releases are available on my maven repository at m2.svn.lol.

Gradle

repositories {
    maven {
        url = uri("https://m2.svn.lol/releases")
    }
}
dependencies {
    implementation("lol.svn:daily-reward-parse-util:1.0.1")
}

Examples

Use the library to take the ID, get the options and claim the first option

try (var reward = HypixelReward.fromId("abcd1234")) {
    reward.retrieveRewardOptions()
            .thenApply(response -> response.getOptions().get(0))
            .thenCompose(RewardOption::claim)
            .thenAccept(unused -> System.out.println("Claimed"))
}

Parse the HTML

var parseResult = RewardParser.parse(html);
System.out.println(parseResult.getSecurityToken());

The parser is an afterthought, so its more of just a 1:1 to the data JSON. You are able to convert the parse result if you have the CSRF cookie which comes from the cookie named _csrf from an HTTP response of the main page. An example of this:

var response = new RewardResponse(HypixelReward.fromId(parseResult.getId()), csrfCookie, parseResult);

About

Parses/requests the daily reward page from rewards.hypixel.net

Resources

License

Stars

Watchers

Forks

Packages

No packages published