Fra*_*ero 15 php android google-play
我试图获取我上传到的应用程序的下载次数Google Play.
我正在搜索一个API(或类似的东西),它通过用户的身份验证来检索下载的数量.我不想要第三方应用程序(如AppAnnie).
如果它可以在PHP上,那就太好了,我发现有一个库,我认为它是我能从谷歌应用程序中获取数据的最接近的API.
但我找不到任何提及Google Play应用程序.
有没有办法获得具有验证密钥的特定应用程序的下载?
提前致谢!
使用google-play-scraper库获取应用信息如下:
示例:
$app = $scraper->getApp('com.mojang.minecraftpe');
Run Code Online (Sandbox Code Playgroud)
结果:
array (
'id' => 'com.mojang.minecraftpe',
'url' => 'https://play.google.com/store/apps/details?id=com.mojang.minecraftpe',
'image' => 'https://lh3.googleusercontent.com/30koN0eGl-LHqvUZrCj9HT4qVPQdvN508p2wuhaWUnqKeCp6nrs9QW8v6IVGvGNauA=w300',
'title' => 'Minecraft: Pocket Edition',
'author' => 'Mojang',
'author_link' => 'https://play.google.com/store/apps/developer?id=Mojang',
'categories' => array (
'Arcade',
'Creativity',
),
'price' => '$6.99',
'screenshots' => array (
'https://lh3.googleusercontent.com/VkLE0e0EDuRID6jdTE97cC8BomcDReJtZOem9Jlb14jw9O7ytAGvE-2pLqvoSJ7w3IdK=h310',
'https://lh3.googleusercontent.com/28b1vxJQe916wOaSVB4CmcnDujk8M2SNaCwqtQ4cUS0wYKYn9kCYeqxX0uyI2X-nQv0=h310',
// [...]
),
'description' => 'Our latest free update includes the Nether and all its inhabitants[...]',
'description_html' => 'Our latest free update includes the Nether and all its inhabitants[...]',
'rating' => 4.4726405143737793,
'votes' => 1136962,
'last_updated' => 'October 22, 2015',
'size' => 'Varies with device',
'downloads' => '10,000,000 - 50,000,000',
'version' => 'Varies with device',
'supported_os' => 'Varies with device',
'content_rating' => 'Everyone 10+',
'whatsnew' => 'Build, explore and survive on the go with Minecraft: Pocket Edition[...]',
'video_link' => 'https://www.youtube.com/embed/D2Z9oKTzzrM?ps=play&vq=large&rel=0&autohide=1&showinfo=0&autoplay=1',
'video_image' => 'https://i.ytimg.com/vi/D2Z9oKTzzrM/hqdefault.jpg',
)
Run Code Online (Sandbox Code Playgroud)
编辑:轻松获取下载次数如下:
echo $app['downloads']; // Outputs: '10,000,000 - 50,000,000'
Run Code Online (Sandbox Code Playgroud)
或者如果你想要左边的值:
$matches = null;
$returnValue = preg_match('/.*(?= -)/', '10,000,000 - 50,000,000', $matches);
echo $matches[0]; // Outputs: '10,000,000'
Run Code Online (Sandbox Code Playgroud)
或者,如果您想要正确的值:
$matches = null;
$returnValue = preg_match('/(?<=- ).*/', '10,000,000 - 50,000,000', $matches);
echo $matches[0]; // Outputs: '50,000,000'
Run Code Online (Sandbox Code Playgroud)
然后使用以下方法轻松将其转换为整数:
$count = null;
$returnValue = (int)preg_replace('/,/', '', $matches[0], -1, $count);
echo $returnValue; // Outputs: 10000000 or 50000000
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5993 次 |
| 最近记录: |