google-play-scraper icon indicating copy to clipboard operation
google-play-scraper copied to clipboard

Search is again stop working

Open rsutariy opened this issue 2 years ago • 12 comments

  • Operating System:MacOS 12.4 and Amazon Linux 2
  • Node version:16.16.0
  • google-play-scraper version:9.1.1

Description:

Search is not working properly. It throws an error more than corrected result for same keyword. keywords examples : Facebook, Walmart etc..

Example code:

gplay.search({
    term: "facebook",
    num: 2
  }).then(console.log, console.log);

Error message:

Error TypeError: Cannot read properties of undefined (reading 'map')

rsutariy avatar Oct 04 '22 16:10 rsutariy

It works for a 40% chance. I suggest u use a try-catch and loop the search until you get the results.

ansoncen avatar Oct 06 '22 12:10 ansoncen

Having the same issue with some calls, but yea, workaround seems to loop until it works, just not really efficient.

Djip avatar Oct 06 '22 14:10 Djip

Adding loop will definitely work but Is there any long term solution?

rsutariy avatar Oct 06 '22 16:10 rsutariy

Depends in anyone finds a solution to the problem. @facundoolano

Djip avatar Oct 06 '22 19:10 Djip

https://github.com/facundoolano/google-play-scraper/compare/main...Djip:google-play-scraper:main#diff-5fa3e79ff4f9f5b6d3a08d3abab2c8db53823a6b1e36d9ecd723792890870aaf

I've made these changes in my local fork, and it seems to work fine, but haven't had too much time to test it in different scenarios.

Note: Looping only seemed to work for a little bit of time. Perhaps cause some of the servers being hit still were on the old patch, but now most of them is on the "new"

Djip avatar Oct 07 '22 10:10 Djip

@Djip, how about opening a PR with your change? :)

CyrilCermak avatar Oct 09 '22 16:10 CyrilCermak

@Djip, how about opening a PR with your change? :)

As mentioned, i'm not 100% sure this works every time

Djip avatar Oct 10 '22 10:10 Djip

@facundoolano Any update?

rsutariy avatar Oct 11 '22 15:10 rsutariy

I have a same issue. and fix that with try catch loop until it works.

insungson avatar Oct 13 '22 06:10 insungson

@Djip, I am happy to give it a test drive if you open a PR with the change. :)

CyrilCermak avatar Oct 13 '22 18:10 CyrilCermak

I opened a PR with your change @Djip, it works perfectly fine for me. @facundoolano, can you please look into it? Thanks a lot! https://github.com/facundoolano/google-play-scraper/pull/600

CyrilCermak avatar Oct 16 '22 17:10 CyrilCermak

Fixed with PR #645

This part was incorrect : return R.is(String, sectionTitle) && (R.isEmpty(sectionTitle)

The string could be empty or "Apps" (lang : en), "Applications" (lang : fr)...

In PR#645, i changed the code with return R.is(String, sectionTitle) && (R.isEmpty(sectionTitle)

It seems to work perfectly

jbigman avatar Jul 27 '23 14:07 jbigman