Created
July 28, 2012 17:07
-
-
Save emirkin/3194028 to your computer and use it in GitHub Desktop.
Basic example for Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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