Official minimal Java wrapper for waifu.pics.
Refer to the docs for available endpoints currently in the API
For Maven
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.Waifu-pics</groupId>
<artifactId>Waifus4J</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
For Gradle
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.Waifu-pics:Waifus4J:master-SNAPSHOT'
}
Get a random image from waifu endpoint in sfw
category
WaifuClient client = new WaifuClient();
System.out.println(client.getSFWImage(Endpoints.SFW.WAIFU));
try {
WaifuClient client = new WaifuClient();
WaifuImage image = client.downloadSFWImage(Endpoints.SFW.WAIFU);
OutputStream os = new FileOutputStream(image.filename);
os.write(image.buffer);
os.close();
} catch (Exception ignored) {}
the available categories are sfw
, and nsfw
. Available endpoints are here