diff --git a/README.md b/README.md index 035ae60..310f2a7 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,14 @@ from googlesearch import search search("Google", sleep_interval=5, num_results=200) ``` +``` +If requesting more than 10 results, but want to manage the batching yourself? +Use `start_num` to specify the start number of the results you want to get: +```python +from googlesearch import search +search("Google", sleep_interval=5, num_results=200, start_result=10) +``` + If you are using a HTTP Rotating Proxy which requires you to install their CA Certificate, you can simply add `ssl_verify=False` in the `search()` method to avoid SSL Verification. ```python from googlesearch import search diff --git a/googlesearch/__init__.py b/googlesearch/__init__.py index b4697b4..eb8264d 100644 --- a/googlesearch/__init__.py +++ b/googlesearch/__init__.py @@ -36,13 +36,14 @@ def __init__(self, url, title, description): def __repr__(self): return f"SearchResult(url={self.url}, title={self.title}, description={self.description})" -def search(term, num_results=10, lang="en", proxy=None, advanced=False, sleep_interval=0, timeout=5, safe="active", ssl_verify=None, region=None): + +def search(term, num_results=10, lang="en", proxy=None, advanced=False, sleep_interval=0, timeout=5, safe="active", ssl_verify=None, region=None, start_num=0): """Search the Google search engine""" # Proxy setup proxies = {"https": proxy, "http": proxy} if proxy and (proxy.startswith("https") or proxy.startswith("http")) else None - start = 0 + start = start_num fetched_results = 0 # Keep track of the total fetched results while fetched_results < num_results: