An extention of the great Retrofit with integration of Estivate
public static void main(String args[]) {
Futurefit adapter = new Futurefit.Builder()
.baseUrl("https://www.google.com/")
.build();
GoogleApi create = adapter.create(GoogleApi.class);
String stats = create.search("retrofit").getResultStatistics();
System.out.println(stats);
}
public interface GoogleApi {
@Estivate
@GET("/search?hl=en&safe=off")
@Headers({ "User-Agent:Mozilla/5.0 Firefox/68.0" })
public Page search(@Query("q") String query);
}
public class Page {
// get the div holding statistics
@Text(select="#resultStats")
public String resultStatistics;
}
<dependency>
<groupId>com.github.btheu.futurefit2</groupId>
<artifactId>futurefit</artifactId>
<version>0.4.3</version>
</dependency>