Ne-Lexa / google-play-scraper

PHP scraper to get data from Google Play
MIT License
78 stars 38 forks source link

check if app exists in appstore fails. Country code incorrect #21

Closed BrunoFischerGermany closed 2 years ago

BrunoFischerGermany commented 2 years ago

Hello!

I have a Question:

I have this Code $myAppID = "de.aok.erezept"; $gplay = new \Nelexa\GPlay\GPlayApps($defaultLocale = 'de_DE', $defaultCountry = 'de'); $appId = new \Nelexa\GPlay\Model\AppId($myAppID, 'de'); $exists = $gplay->existsApp($appId);

i use this headless on a commandline.

my output is now

[INFO] 🌎 [2022-03-10T09:16:36+00:00] "HEAD https://play.google.com/store/apps/details?id=de.aok.erezept&hl=de_DE&gl=us HTTP/1.1" 200 "OK" - "HEAD /store/apps/details?id=de.aok.erezept&hl=de_DE&gl=us HTTP/1.1 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0 Host: play.google.com" - 950704

[INFO] 🌎 [2022-03-10T09:16:36+00:00] "GET https://play.google.com/store/apps/details?id=de.aok.erezept&hl=de_DE&gl=de HTTP/1.1" 404 "Not Found" - "GET /store/apps/details?id=de.aok.erezept&hl=de_DE&gl=de HTTP/1.1 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0 Host: play.google.com" -

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: GET https://play.google.com/store/apps/details?id=de.aok.erezept&hl=de_DE&gl=de resulted in a 404 Not Found response: <!DOCTYPE html><meta name="viewport" conte (truncated...) in /var/www/composer/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Stack trace:

0 /var/www/composer/vendor/guzzlehttp/guzzle/src/Middleware.php(69): GuzzleHttp\Exception\RequestException::create()

1 /var/www/composer/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp{closure}()

2 /var/www/composer/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler()

3 /var/www/composer/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}()

4 /var/www/composer/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(158): GuzzleHttp\Promise\TaskQueue->run()

5 /var/www/composer/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(183): GuzzleHttp\Handler\CurlMultiHandler->tick()

6 /var/www/composer/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Handler\CurlMultiHandler->execute()

7 /var/www/composer/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()

8 /var/www/composer/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()

9 /var/www/composer/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()

10 /var/www/composer/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()

11 /var/www/composer/vendor/guzzlehttp/promises/src/EachPromise.php(116): GuzzleHttp\Promise\Promise->wait()

12 /var/www/composer/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Promise\EachPromise->GuzzleHttp\Promise{closure}()

13 /var/www/composer/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()

14 /var/www/composer/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()

15 /var/www/composer/vendor/nelexa/google-play-scraper/src/HttpClient/HttpClient.php(202): GuzzleHttp\Promise\Promise->wait()

16 /var/www/composer/vendor/nelexa/google-play-scraper/src/GPlayApps.php(217): Nelexa\GPlay\HttpClient\HttpClient->requestPool()

17 /var/www/composer/vendor/nelexa/google-play-scraper/src/GPlayApps.php(182): Nelexa\GPlay\GPlayApps->getAppsInfo()

18 /var/www/cron/update_download_android_app.php(146): Nelexa\GPlay\GPlayApps->getAppInfo()

19 {main}

Next Nelexa\GPlay\Exception\GooglePlayException: Client error: GET https://play.google.com/store/apps/details?id=de.aok.erezept&hl=de_DE&gl=de resulted in a 404 Not Found response: <!DOCTYPE html><meta name="viewport" conte (truncated...) in /var/www/composer/vendor/nelexa/google-play-scraper/src/GPlayApps.php:219 Stack trace:

0 /var/www/composer/vendor/nelexa/google-play-scraper/src/GPlayApps.php(182): Nelexa\GPlay\GPlayApps->getAppsInfo()

1 /var/www/cron/update_download_android_app.php(146): Nelexa\GPlay\GPlayApps->getAppInfo()

2 {main}

thrown in /var/www/composer/vendor/nelexa/google-play-scraper/src/GPlayApps.php on line 219

In the First check it calls https://play.google.com/store/apps/details?id=de.aok.erezept&hl=de_DE&gl=us in the secound step it calls https://play.google.com/store/apps/details?id=de.aok.erezept&hl=de_DE&gl=de

There is an difference. the german (de) the App is not there. in de us is the app there.

what i have to do?

BrunoFischerGermany commented 2 years ago

Ups i went wrong.

i change my line to $appId = new \Nelexa\GPlay\Model\AppId($myAppID, $defaultLocale = 'de_DE', $defaultCountry = 'de');