您可以尝试的另一个非官方 API 也可以查看: www.playstoreapi.com
它是非官方的,但易于使用(非商业用途免费),它有很多不错的功能,如搜索和排行榜。从他们的文档部分:
节点.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));
}