Skip to content

Instantly share code, notes, and snippets.

@emirkin
Created July 28, 2012 17:07
Show Gist options
  • Save emirkin/3194028 to your computer and use it in GitHub Desktop.
Save emirkin/3194028 to your computer and use it in GitHub Desktop.
Basic example for Android
BobikClient bobik = new BobikClient("YOUR_AUTH_KEY");
JSONObject request = new JSONObject();
for (String url : new String[]{"amazon.com", "google.com"})
request.accumulate("urls", url);
for (String query : new String[]{"//a/@href", "return $('.logo').length"})
request.accumulate("queries", query);
Job job = bobik.scrape(request, new JobListener() {
public void onSuccess(JSONObject scraped_data) {
System.out.println("Received data: " + scraped_data);
}
public void onProgress(float currentProgress) {
System.out.println("Current progress is " + currentProgress*100 + "%");
}
public void onErrors(Collection<String> errors){
for (String s : errors)
System.err.println("Error for job " + job.id() + ": " + s);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment