Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on search method with short term fields #161

Open
nsiriaporn opened this issue Jun 28, 2021 · 1 comment · May be fixed by #166
Open

Error on search method with short term fields #161

nsiriaporn opened this issue Jun 28, 2021 · 1 comment · May be fixed by #166

Comments

@nsiriaporn
Copy link

  • Operating System: Windows10 Home 19041.1052
  • Node version: 14.16.0
  • app-play-scraper version: 16.3

Description:

Describe your issue here

When performing a one-term search (i.e. "travel", "diet", "commute") and also "active travel", using the method 'search', the promise return an error. However, some two-word search works. I've used "active commute" which works but "active travel" does not.

Example code:

// Put code to reproduce the issue here
scraper = require('app-store-scraper');
scraper.search({
    term:  "diet",
    country: "us",
    num: 250,
    fullDetail: true
  }).then(console.log, console.log);

Error message:

The error is the json in attached file.

error.txt

@jonaskuske jonaskuske linked a pull request Oct 15, 2021 that will close this issue
@jonaskuske
Copy link

From my testing, this has to do with the amount of results, not the term itself. The /search endpoint can respond with many results, but the /lookup endpoint that is used afterwards to get result data is limited to 200 IDs per request.

When you choose a term with a lot of results (like most short terms) and the num option is > 200, more than 200 IDs are passed to the lookup request and we receive the 502 error linked in the issue description. Changing the term to something that has less than 200 results makes the error go away, so does removing the num option or setting it to a number < 200.

I've submitted a PR that makes sure we only send 200 IDs to the /lookup endpoint, and opts for multiple lookup requests if there are more than 200 IDs: #166

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants