Comments (5)
Good point, I was actually struggling to understand why pagination didn't work for scholar.
A consistent API would be great! Thanks for sharing the snippet.
from google-search-results-python.
I'd just roll out a new version of the package but I have taking into account your code above.
My concern is that Google search provides duplicated search results when pagination.
Should we try to build a filtering mechanism on the back end or the client side.
So far, we are letting the user deal with this issue.
My experiment shows that it's not Serp API fault but the search engine returned similar search result from one page to another.
What do you think?
from google-search-results-python.
Sorry for the long wait on this.
I was working with a couple of wrong assumption.
1- page start, num are always supported / translate if needed.
2- start = f(x * num)
1- On the top the suggestion above, I can implement a mapping table per search engine.
# set default
self.start_key = "start"
self.num_key = "num"
self.end_key = "end"
# override per search engine
if engine == BAIDU_ENGINE:
self.start_key = "pn"
self.num_key = "rn"
So, the response.next
can be parse for most of the search engine except Google Scholar.
2- The way the offset is returned by SerpApi is not consistent.
Google takes start=0, num=20
- page 1 : start=0
- page 2 : start=20
- page 3 : start=40
see: tests/test_google_search.py#test_paginate in branch: 2.5.0
Ebay takes pn=0, rn=20
- page 1 : start=2
- page 2 : start=3
- page 3 : start=4
see: tests/test_ebay_search.py#test_paginate in branch: 2.5.0
https://github.com/serpapi/google-search-results-python/pull/new/2.5.0
Could we improve the consistency between Search engines on the backend or the client ?
Or do we even care ? The user might not switch back on forth between search engine.
from google-search-results-python.
Could we improve the consistency between Search engines on the backend or the client ?
It depends on the target website — we mirror their query parameters. But consistency on the SerpApi backend should be improved too. For example, response for google_scholar_profiles
engine contains pagination
but no serpapi_pagination
.
Currently, a reliable way to consume pagination across all search engines on the client is to use result['serpapi_pagination']['next']
.
from google-search-results-python.
@jvmvik I'd not filter duplicated results on the SerpApi side.
from google-search-results-python.
Related Issues (20)
- How to get "related articles" links from google scholar via serpapi? HOT 3
- [Pagination] Pagination isn't correct and it skips index by one HOT 1
- [Version] Update PyPi to include the most up-to-date version HOT 3
- Setting Timeout on Instantiation for GoogleSearch HOT 3
- .. HOT 2
- AttributeError during the import of the module: `initialized module 'serpapi' has no attribute 'GoogleSearch' (most likely due to a circular import)` HOT 5
- Exception not handled on SerpApiClient.get_json HOT 1
- [Feature Request] Add Async Implementation HOT 5
- [Discuss] Wrapper longer response times caused by some overhead/additional processing
- [Feature request] Make `async: True` do everything under the hood HOT 1
- How to add proxy and ssl certs while using the Search API? I am currently trying to access it via my corporate network. HOT 1
- requests.exceptions.SSLError: HTTPSConnectionPool(host='serpapi.com', port=443) HOT 1
- Python package should not include tests
- SSLCertVerificationError [SSL: CERTIFICATE_VERIFY_FAILED] error HOT 1
- Python 3.8+, Fatal Python error: Segmentation fault when calling requests.get(URL, params) with docker python-3.8.2-slim-buster/openssl 1.1.1d and python-3.9.10-slim-buster/openssl 1.1.1d HOT 1
- ImportError: cannot import name 'GoogleSearch' from 'serpapi' HOT 7
- Google lens can't find my image
- ImportError: cannot import name 'GoogleSearch' from 'serpapi' python 3.10 HOT 2
- get_html() Returns JSON Instead of HTML
- Different results from serpapi (Google Trends) versus Google Trends site HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-search-results-python.