Skip to content

Commit 5edbfcf

Browse files
committed
parseApplication(): add ads+iap marker
1 parent 9e3d46a commit 5edbfcf

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ Array
137137
[votes] => 1,820
138138
[price] => 0
139139
[size] => Varies with device
140+
[ads] => 0
141+
[iap] => 0
140142
[success] => 1
141143
)
142144
```

google-play.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ protected function getApplicationPage($packageName, $lang='en_US', $loc='US') {
5353
* Success is signaled by success=1, and details are given via the keys
5454
* packageName, name, developer, category, type (game, app, family), description,
5555
* icon, images (array of screenshot URLs), updated, version, require (min Android version),
56-
* install (number of installs), age, rating (float), votes, price, size
56+
* install (number of installs), age, rating (float), votes, price, size,
57+
* ads (has ads: 0|1), iap (in-app-payment used: 0|1)
5758
* if not explicitly specified otherwise, values are strings
5859
*/
5960
public function parseApplication($packageName, $lang='en_US', $loc='US') {
@@ -119,6 +120,10 @@ public function parseApplication($packageName, $lang='en_US', $loc='US') {
119120
$values["rating"] = $this->getRegVal('/<div class="BHMmbe"[^>]*>(?<content>[^<]+)<\/div>/i');
120121
$values["votes"] = $this->getRegVal('/<span class="AYi5wd TBRnV"><span[^>]*>(?<content>[^>]+)<\/span>/i');
121122
$values["price"] = $this->getRegVal('/<meta itemprop="price" content="(?<content>[^"]+)">/i');
123+
$test = $this->getRegVal('/<div class="bSIuKf">(?<content>[^<]+)<div/i'); // <div class="bSIuKf">Contains Ads<div
124+
(empty($test)) ? $values["ads"] = 0 : $values["ads"] = 1;
125+
$test = $this->getRegVal('/<div class="aEKMHc">&middot;<\/div>(?<content>[^<]+)</i'); // <div class="aEKMHc">&middot;</div>Offers in-app purchases</div>
126+
(empty($test)) ? $values["iap"] = 0 : $values["iap"] = 1;
122127

123128
$limit = 3;
124129
while ( empty($values["summary"]) && $limit > 0 ) { // sometimes protobuf is missing, but present again on subsequent call

0 commit comments

Comments
 (0)