raulr / google-play-scraper

A PHP scraper to get app data from Google Play
MIT License
125 stars 65 forks source link

Get rank for an given app #2

Closed murthyanitaa closed 8 years ago

murthyanitaa commented 8 years ago

Hi raulr, thanks for this awesome scraper. I saw from the sample, that the rank of an app is not provided by default. Is there a way to get the ramk of a given app using the scraper? Can you please help me on how to acheive that?

raulr commented 8 years ago

Hi Murthyanitaa,

I don't think Google Play has something as an absolute rank for an app. For example, a game that is first on ACTION list, may be the fourth on ARCADE.

What you can get is the rank of an app inside a list, as they are returned sorted by the scraper:

$apps = $scraper->getList('topselling_free', 'SOCIAL');
foreach ($apps as $rank => $app) {
    echo $app['title']." is #".($rank + 1)." in SOCIAL".PHP_EOL;
}

I hope you find this useful.

murthyanitaa commented 8 years ago

hi Raulr,

Sorry for the late reply. Thanks for the help. What I meant was exactly that. If we can specify a category or a collection, is it possible to get the top ranked apps in those categories or collections. For eg: 1) the top ranked apps in entertainment? 2) The top ranked apps in top free apps?

I see from your reply that you can get the top ranked apps in a list. But is the second one possible?

Thanks for your help raulr!

raulr commented 8 years ago

You can skip the category and get only a collection:

$apps = $scraper->getList('topselling_free');
jalayoza commented 6 years ago

I am getting this error

Fatal error: Default value for parameters with a class type hint can only be NULL in /Applications/XAMPP/xamppfiles/htdocs/kaayaa-web/wp-content/themes/kaayaa/google-play-scraper-master/google-play-scraper/vendor/symfony/browser-kit/Client.php on line 275

My code is

include_once('google-play-scraper-master/google-play-scraper/vendor/autoload.php' );

use Raulr\GooglePlayScraper\Scraper;

$scraper = new Scraper();

Please help me