I need to download a few Apps from google play for analysis purpose. But I don't want to do it manually (I have to do it often and each time the Apps that I want to download change!).
So, the question is, whether I can write a program to download the Apps or not. If it is possible, how?
I have seen this plugin for chrome: http://codekiem.com/2012/02/24/apk-downloader/ but I cannot trust the author (the App requires google user and pass and device ID) and have decide to implement my own program.
For those of you who are looking for a Java implementation, here it is:
Top level Steps:
Detailed Steps:
Gmail ID and password are obvious! For Android ID follow the demirozali and use "getAndroidID" function. I could not make "getAuthToken" work! Therefore I used toxicbakery to get security token. Note that the function "updateToken" (which actually gets you the security token) should be called in an AsyncTask not on UI Thread.
From Akdeniz github site download the "googleplaycrawler-0.1-SNAPSHOT.jar" file.
I couldn't make use of "GooglePlayAPI" class in the jar file. So I decided to change the CLI version. The CLI class in "googleplaycrawler-0.1-SNAPSHOT.jar" is called "googleplay.java" which can be downloaded from the source files.
Rename "googleplay.java" to "Changed_googleplay.java" and modify it. Such that the method "searchCommand()" returns a arrayList of String, rather than printing the result on console.
Having done all the previous steps, create a project in jetBrains or ... and add "googleplaycrawler-0.1-SNAPSHOT.jar" as a library. Also, add "Changed_googleplay.java" to your src directory. Finally use the following method in your application. You can use the following class to search a query and then download all Free Apps corresponding to that query.
public void SearchAndDownload() {
String login = "[email protected]";
String password = "xxxx";
String androidId = "xxxx";
String securitytoken = "xxxx";
String command = "search";
String query = "Maps";
String offest = "0";
String number = "5";
Changed_googleplay gp = new Changed_googleplay();
ArrayList<String> res = gp.operate(new String[]{"-i", androidId, "-e", login, "-p", password, "-t", securitytoken, command, "-o", offest, "-n", number, query});
res.remove(0);
if (command.equals("search")) {
System.out.println("Title"+"\t"+"Package Name"+"\t"+"Price"+"\t"+"Number of Downloads");
for (String line : res){
String[] split = line.split(Changed_googleplay.DELIMETER);
String name = split[0];
String packageName = split[1];
String creator = split[2];
String price = split[3];
String size = split[4];
String dlNO = split[5];
if(price.equals("Free")){
System.out.println(name+"\t"+packageName+"\t"+price+"\t"+dlNO);
gp.operate(new String[]{"-i", androidId, "-e", login, "-p", password, "-t", securitytoken, "download", packageName});
}
}
}
}
You may want to take a look at the list of command line options in the crawler project main page.
have fun!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With