Is it possible to get number of downloads of an application from Google Play?
This is about meta data api. You can look at below.
https://developers.google.com/android-publisher/api-ref/reviews
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
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".