Is it possible to get number of downloads of an application from Google Play?

15,789

Solution 1

This is about meta data api. You can look at below.

https://developers.google.com/android-publisher/api-ref/reviews

Solution 2

Use the google-play-scraper library to get an app information as below:

Example:

$app = $scraper->getApp('com.mojang.minecraftpe');

Result:

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',
)

EDIT: Easily get downloads count as below:

echo $app['downloads']; // Outputs: '10,000,000 - 50,000,000'

Or if you want the left value:

$matches = null;
$returnValue = preg_match('/.*(?= -)/', '10,000,000 - 50,000,000', $matches);
echo $matches[0]; // Outputs: '10,000,000'

Or if you want the right value:

$matches = null;
$returnValue = preg_match('/(?<=- ).*/', '10,000,000 - 50,000,000', $matches);
echo $matches[0]; // Outputs: '50,000,000'

Then easily convert it to integer using:

$count = null;
$returnValue = (int)preg_replace('/,/', '', $matches[0], -1, $count);
echo $returnValue; // Outputs: 10000000 or 50000000

Solution 3

You need to Scrape it. Generally speaking, & of course in this particular case, when the website(here: Google Play) does not provide an API to make your(client's) desired data accessible to him, Web scraping is one of the best methods to gather your required information.

Nearly every piece of information that you can see on a web page, can be scraped. Nowadays with great improvements of web scrapers, not only you are able to grab data from a target website, but also "crawling it like a user", "posting information to website via forms", "logging in as a user" & etc. has become a routine for any web scraper.

There are very strong scrapers out there, like Scrapy(likely the most reputed one, written in Python) almost for every language. AFAIK the best web scraper in PHP, is Goutte written by legendary @fabpot from FriendsOfPHP.

From the Data-Extraction POV, Goutte supports both "CSS Selectors" & XPath (Because it uses Symfony's DOM Crawler as Crawling engine). So you can crawl the document the way you want to extract every piece of information in any hidden corner of a web page!

You can go faraway in scraping with Goutte, But just as a tiny example for grabbing "number of installs" from an ordinary App page in a blink of an eye:

use Goutte\Client;

$Client = new Client();

/**
* @var \Symfony\Component\DomCrawler\Crawler 
*/
$Crawler = $Client->request('GET', "https://play.google.com/store/apps/details?id=com.somago.brainoperator&hl=en");

$numberOfInstalls = $Crawler->filter('div.details-section-contents div.meta-info')->eq(1)->filter('div.content')->eq(0)->text();

echo $numberOfInstalls;

It will simply print Brain Operator game's "number of downloads".

Solution 4

This project https://github.com/ArcadiaConsulting/appstorestats is a API in Java to get statistics from Google Play and AppStore

Solution 5

checkout this library 42 matters gives number of downloads , rating many more

Share:
15,789
Francisco Romero
Author by

Francisco Romero

The best way to learn something is trying to help others to solve their issues that you have never tried before. This is the reason why I am in Stackoverflow. Now starting with web developing.

Updated on June 06, 2022

Comments

  • Francisco Romero
    Francisco Romero about 2 years

    I am trying to get the number of downloads of an application that I have uploaded to Google Play.

    I am searching for an API (or something similar) that retrieves to me the number of downloads with the authentification of the user. I do not want third party applications (like AppAnnie).

    It would be great if it could be on PHP and I found that there is a library which I think it is the most closest API I could find to get data from Google applications.

    Google APIs Client Library for PHP

    but I cannot find any mention to Google Play applications.

    Is there some way to get the downloads of an specific application having the authentification keys?

    Thanks in advance!