pavi2410 / PlayBadges

Show off your Play Store™ app's downloads and ratings in your repo
https://playbadges.pavi2410.me
80 stars 3 forks source link

Ratings don't seem to appear? #12

Closed akshaaatt closed 1 year ago

akshaaatt commented 2 years ago

Some apps don't show the ratings, can this be fixed?

Ex: https://github.com/metabrainz/musicbrainz-android

pavi2410 commented 2 years ago

Ummm, I just checked the Play Store pages for a few apps including yours. I found that Musicbrainz app's page doesn't have a ratings section due to which the scraper didn't work.

image

Here's the whatsapp's page

image

For once, I thought it's due to the policy change: https://android-developers.googleblog.com/2021/08/making-ratings-and-reviews-better-for.html But I guess that's not the case.

Could you confirm the same? I would say it's worth to contact Play Store support about the same.

akshaaatt commented 2 years ago

Hi @pavi2410! I actually have a few projects private and even they don't seem to show the ratings, given when things seem fine on the play store. Is there a minimum requirement of something like 50 ratings to show them here?

akshaaatt commented 2 years ago

I found more examples and none of the apps I have or know show the ratings. https://github.com/phw/PicardBarcodeScanner

pavi2410 commented 2 years ago

For once, I thought it's due to the policy change: https://android-developers.googleblog.com/2021/08/making-ratings-and-reviews-better-for.html But I guess that's not the case.

I can confirm that this is causing the trouble.

Case 1: https://play.google.com/store/apps/details?id=org.metabrainz.android&hl=en&gl=us Case 2: https://play.google.com/store/apps/details?id=org.metabrainz.android (Region = India)

It happens to return the rating in the India region, but not for the US region, which the scraper library defaults to.

pavi2410 commented 2 years ago

A solution which came in my mind is that I could detect the country from which the badge request is coming from, and fetch data for that country.

akshaaatt commented 2 years ago

Cool, did you try out the fix?

pavi2410 commented 2 years ago

Cool, did you try out the fix?

Not yet. Later today, in the evening

pavi2410 commented 2 years ago

Seems to work now

Case 1: https://play.google.com/store/apps/details?id=org.metabrainz.android&hl=en&gl=us Case 2: https://play.google.com/store/apps/details?id=org.metabrainz.android (Region = India)

image

Case 1: Case 2: image

akshaaatt commented 2 years ago

Cool! Have you pushed this fix?

pavi2410 commented 2 years ago

Yep! https://github.com/pavi2410/PlayBadges/commit/f3d54937fbc764fcb643e0344ba2f4a422355b77

And it's live too

akshaaatt commented 2 years ago

Should I make some changes to have the correct implementation be visible on https://github.com/metabrainz/musicbrainz-android, or just wait?

pavi2410 commented 2 years ago

Ideally, you don't need to make any changes. But you have to be wary of these things:

  1. I enabled memoization of the requests for upto 24 hrs. This lowers the risk of IP ban from Play Store as a preventive measure.
  2. Browser store the badges in the cache storage, so you may have to wait until the cache is invalidated. Although I haven't added any headers for caching, I probably should add them to control the lifetime of the cache precisely.
akshaaatt commented 2 years ago

Cool, let me know when the change starts reflecting. Thanks