Skip to content

Commit 7a9a224

Browse files
authored
Merge pull request #32 from IzzySoft/minfix
fix eval of featureGraphic, add dev email+website
2 parents 053f99a + c61599c commit 7a9a224

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

google-play.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -242,22 +242,12 @@ public function parseApplication($packageName, $lang='en_US', $loc='US') {
242242
if ( !empty($data["aggregateRating"]["ratingCount"]) ) $values["votes"] = $data["aggregateRating"]["ratingCount"];
243243
}
244244

245-
$limit = 5; $proto = '';
246-
while ( empty($proto) && $limit > 0 ) { // sometimes protobuf is missing, but present again on subsequent call
247-
$proto = json_decode($this->getRegVal("/key: 'ds:4'. hash: '\d+'. data:(?<content>\[\[\[.+?). sideChannel: .*?\);<\/script/ims")); // DataSource:4 = featureGraphic, video, summary
248-
if ( empty($proto) || empty($proto[1]) ) {
249-
$this->getApplicationPage($packageName, $lang, $loc);
250-
--$limit;
251-
} else {
252-
if ( empty($values["featureGraphic"]) ) $values["featureGraphic"] = $proto[1][2][96][0][3][2];
253-
if ( empty($values["video"]) && !empty($proto[1][2][100]) ) $values["video"] = $proto[1][2][100][0][0][3][2];
254-
if ( empty($values["summary"]) && !empty($proto[1][2][73]) ) $values["summary"] = $proto[1][2][73][0][1]; // 1, 2, 73, 0, 1
255-
// category: $proto[1][2][79][0][0][0]; catId: $proto[1][2][79][0][0][2]
256-
// screenshots: 1,2,78,0,0-n; 1=format,2=[wid,hei],3.2=url
257-
// more details see: https://github.com/JoMingyu/google-play-scraper/blob/2caddd098b63736318a7725ff105907f397b9a48/google_play_scraper/constants/element.py
258-
break;
259-
}
260-
}
245+
$proto = json_decode($this->getRegVal("/key: 'ds:5'. hash: '\d+'. data:(?<content>\[\[\[.+?). sideChannel: .*?\);<\/script/ims"));
246+
if ( empty($values["featureGraphic"]) && !empty($proto[1][2][96][0][3][2]) ) $values["featureGraphic"] = $proto[1][2][96][0][3][2];
247+
if ( empty($values["video"]) && !empty($proto[1][2][100][0][0][3][2]) ) $values["video"] = $proto[1][2][100][0][0][3][2];
248+
if ( empty($values["summary"]) && !empty($proto[1][2][73][0][1]) ) $values["summary"] = $proto[1][2][73][0][1];
249+
if ( empty($proto[1][2][69][1][0]) ) $values["developerEmail"] = ""; else $values["developerEmail"] = $proto[1][2][69][1][0];
250+
if ( empty($proto[1][2][69][0][5][2]) ) $values["developerWebsite"] = ""; else $values["developerWebsite"] = $proto[1][2][69][0][5][2];
261251

262252
// reviews
263253
$values["reviews"] = [];

0 commit comments

Comments
 (0)