query the google play store for the version of an app?

前端 未结 4 1558
悲&欢浪女
悲&欢浪女 2020-11-30 06:57

is there a way to query the play store for the version of an app without the need for user-credentials. I am aware of this unofficial API:

http://code.google.com/p/a

相关标签:
4条回答
  • 2020-11-30 07:12

    Found a suitable API via G+: this is the API: https://androidquery.appspot.com

    example call: https://androidquery.appspot.com/api/market?app=org.ligi.fast

    and this wrapper/code: https://github.com/androidquery/androidquery

    0 讨论(0)
  • 2020-11-30 07:13

    Google Play does not provide any official APIs for retrieving metadata. You could however, check the unofficial API at http://code.google.com/p/android-market-api/.

    Specifically, take a look at the Wiki page HowToSearchApps. The response to the query contains version information:

    Your query will be something like:

    String query = "maps";
    AppsRequest appsRequest = AppsRequest.newBuilder()
                                    .setQuery(query)
                                    .setStartIndex(0).setEntriesCount(10)
                                    .setWithExtendedInfo(true)
                                    .build();
    
    session.append(appsRequest, new Callback<AppsResponse>() {
             @Override
             public void onResult(ResponseContext context, AppsResponse response) {
                      // Your code here
                      // response.getApp(0).getCreator() ...
                      // see AppsResponse class definition for more infos
             }
    });
    

    Your response will be of the format:

    {
      "app": [
        {
          "rating": "4.642857142857143",
          "title": "Ruboto IRB",
          "ratingsCount": 14,
          "creator": "Jan Berkel",
          "appType": "APPLICATION",
          "id": "9089465703133677000",
          "packageName": "org.jruby.ruboto.irb",
          "version": "0.1",
          "versionCode": 1,
          "creatorId": "\"Jan Berkel\"",
          "ExtendedInfo": {
            "category": "Tools",
            "permissionId": [
    ...
    

    Then of course you may use a JSON Parser or do a string search.

    0 讨论(0)
  • 2020-11-30 07:30

    Also check out: www.playstoreapi.com

    It's unofficial but easy to use (free for non commercial use). you can get data about apps, search the play store and get top charts data. from their documentation section:

    Node.js:

    var request     = require('request');
    var apiKey      = 'wij5czxu3mxkzkt9'; // your API key
    var packageName = 'com.whatsapp';     // package Name, e.g. com.whatsapp for WhatsApp
    
    var url = 'http://api.playstoreapi.com/v1.1/apps/' + packageName + '?key=' + apiKey;
    
    request({
        url: url,
        json: true
        }, function (error, response, body) {
        if (!error && response.statusCode === 200) {
            console.log(body) // Print the json response
        }
    });
    

    HTML/JS:

    <html>
    <head>
    <body>
    <p></p>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    
      <script>
    
      var apiKey = 'wij5czxu3mxkzkt9'; // your API key
      var app    = 'com.whatsapp';     // package com.whatsapp for WhatsApp
    
      var url = 'http://api.playstoreapi.com/v1.1/apps/' + app + '?key=' + apiKey;
    
      $.getJSON(url).done(function(appDetails) {
        $('p:last').html(JSON.stringify(appDetails));
      });
    
      </script>
    </body>
    </head>
    <html>
    

    Python:

    import urllib2
    import json
    
    packageName = 'com.whatsapp'      # package com.whatsapp for WhatsApp
    apiKey      = 'wij5czxu3mxkzkt9'  # your API key
    
    url = 'http://api.playstoreapi.com/v1.1/apps/{0}?key={1}'
    
    response = urllib2.urlopen(url.format(packageName, apiKey))
    
    data = json.load(response)   
    print data
    

    C# .NET:

    string apiKey = "wij5czxu3mxkzkt9"; // your API key
    string app    = "com.whatsapp";     // package com.whatsapp for WhatsApp
    
    string url = "http://api.playstoreapi.com/v1.1/apps/{0}?key={1}";
    
    using (var webClient = new System.Net.WebClient()) {
        string jsonString = webClient.DownloadString(string.Format(url, app, apiKey));
    }
    
    0 讨论(0)
  • 2020-11-30 07:31

    Bear in mind that nowadays a lot of apps have multiple versions running. For those apps with one version you can try 42matters Lookup API, it should give you the correct version.

    0 讨论(0)
提交回复
热议问题