From a376225f3f21e10bd29c4f2ec729df049502095e Mon Sep 17 00:00:00 2001 From: Izzy Date: Sat, 2 Jul 2022 23:12:43 +0200 Subject: [PATCH] parseApplication(): use precise data for ratings/votes if available --- google-play.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/google-play.php b/google-play.php index 63cdd64..c50f8c3 100644 --- a/google-play.php +++ b/google-play.php @@ -211,6 +211,10 @@ public function parseApplication($packageName, $lang='en_US', $loc='US') { if ( empty($values["summary"]) && !empty($data["description"]) ) $values["summary"] = $data["description"]; if (isset($data["contentRating"])) $values["contentRating"] = $data["contentRating"]; else $values["contentRating"] = ""; + if ( isset($data["aggregateRating"]) ) { + if ( !empty($data["aggregateRating"]["ratingValue"]) ) $values["rating"] = $data["aggregateRating"]["ratingValue"]; + if ( !empty($data["aggregateRating"]["ratingCount"]) ) $values["votes"] = $data["aggregateRating"]["ratingCount"]; + } $limit = 5; $proto = ''; while ( empty($proto) && $limit > 0 ) { // sometimes protobuf is missing, but present again on subsequent call