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

[Google Search API] Missing Keys for other_pages #883

Closed
schaferyan opened this issue May 22, 2023 · 3 comments
Closed

[Google Search API] Missing Keys for other_pages #883

schaferyan opened this issue May 22, 2023 · 3 comments
Assignees
Labels
status: queued Ready to work on status: wip Work in progress

Comments

@schaferyan
Copy link

A customer reported that for some searches, pagination.other_pages and serpapi_pagination.other_pages seem to be missing keys.

It's possible that these keys just don't show up in the Playground and Search Inspector. When I try them with the JS/TS library the keys are provided as expected. However they seem to be missing from the Playground in almost every search I tried.

Screenshot 2023-05-22 at 10 09 45 AM

Playground | Search Inspector | Intercom

@schaferyan
Copy link
Author

The customer confirmed it seems to be working in their code - the problem they are seeing is in the Search Inspector.

@schaferyan schaferyan added the status: queued Ready to work on label May 22, 2023
@hartator
Copy link
Contributor

Do you mean the structure of other_pages is odd on our pages?

It does look like an array and an object at the same time:

"other_pages":
{
"https://www.google.com/search?q=AAPL+financials+site%3Afinance.yahoo.com&oq=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=10&sourceid=chrome&ie=UTF-8",
"https://www.google.com/search?q=AAPL+financials+site%3Afinance.yahoo.com&oq=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=20&sourceid=chrome&ie=UTF-8",
"https://www.google.com/search?q=AAPL+financials+site%3Afinance.yahoo.com&oq=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=30&sourceid=chrome&ie=UTF-8",
"https://www.google.com/search?q=AAPL+financials+site%3Afinance.yahoo.com&oq=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=40&sourceid=chrome&ie=UTF-8"
}

Actual JSON has 2,3,4 as keys indeed:

    "other_pages": {
      "2": "https://www.google.com/search?q=AAPL+financials+site%3Afinance.yahoo.com&oq=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=10&sourceid=chrome&ie=UTF-8",
      "3": "https://www.google.com/search?q=AAPL+financials+site%3Afinance.yahoo.com&oq=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=20&sourceid=chrome&ie=UTF-8",
      "4": "https://www.google.com/search?q=AAPL+financials+site%3Afinance.yahoo.com&oq=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=30&sourceid=chrome&ie=UTF-8",
      "5": "https://www.google.com/search?q=AAPL+financials+site%3Afinance.yahoo.com&oq=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=40&sourceid=chrome&ie=UTF-8"
    }
  },
  "serpapi_pagination": {
    "current": 1,
    "next_link": "https://serpapi.com/search.json?device=desktop&engine=google&google_domain=google.com&q=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=10",
    "next": "https://serpapi.com/search.json?device=desktop&engine=google&google_domain=google.com&q=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=10",
    "other_pages": {
      "2": "https://serpapi.com/search.json?device=desktop&engine=google&google_domain=google.com&q=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=10",
      "3": "https://serpapi.com/search.json?device=desktop&engine=google&google_domain=google.com&q=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=20",
      "4": "https://serpapi.com/search.json?device=desktop&engine=google&google_domain=google.com&q=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=30",
      "5": "https://serpapi.com/search.json?device=desktop&engine=google&google_domain=google.com&q=AAPL+financials+site%3Afinance.yahoo.com&safe=active&start=40"
    }
  }

@hartator hartator changed the title [Google Search API] Missing Keys for other_pages [Google Search API] Missing Keys for other_pages May 22, 2023
@schaferyan
Copy link
Author

Yes exactly, the actual JSON response is as intended, but we display it as an array-like object with no keys in the Search Inspector and Playground. The user had the impression we were returning invalid JSON.

@aciddjus aciddjus self-assigned this May 24, 2023
@aciddjus aciddjus added the status: wip Work in progress label May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: queued Ready to work on status: wip Work in progress
Projects
None yet
Development

No branches or pull requests

3 participants