33[ ![ Package] ( https://badge.fury.io/py/google-search-results.svg )] ( https://badge.fury.io/py/google-search-results )
44[ ![ Build] ( https://github.com/serpapi/google-search-results-python/actions/workflows/python-package.yml/badge.svg )] ( https://github.com/serpapi/google-search-results-python/actions/workflows/python-package.yml )
55
6- This Python package is meant to scrape and parse search results from Google, Bing, Baidu, Yandex, Yahoo, Home depot, Ebay and more.. using [ SerpApi] ( https://serpapi.com ) .
6+ This Python package is meant to scrape and parse search results from Google, Bing, Baidu, Yandex, Yahoo, Home Depot, eBay and more, using [ SerpApi] ( https://serpapi.com ) .
77
88The following services are provided:
99- [ Search API] ( https://serpapi.com/search-api )
@@ -34,24 +34,25 @@ search = GoogleSearch({
3434result = search.get_dict()
3535```
3636
37- This example runs a search about "coffee" using your secret api key.
37+ This example runs a search for "coffee" using your secret API key.
3838
3939The SerpApi service (backend)
40- - searches on Google using the search: q = "coffee"
41- - parses the messy HTML responses
42- - return a standardizes JSON response
40+ - Searches Google using the search: q = "coffee"
41+ - Parses the messy HTML responses
42+ - Returns a standardized JSON response
4343The GoogleSearch class
44- - Format the request
45- - Execute GET http request against SerpApi service
46- - Parse JSON response into a dictionary
47- Et voila..
44+ - Formats the request
45+ - Executes a GET http request against SerpApi service
46+ - Parses the JSON response into a dictionary
47+
48+ Et voilà...
4849
4950Alternatively, you can search:
5051- Bing using BingSearch class
5152- Baidu using BaiduSearch class
5253- Yahoo using YahooSearch class
53- - duckduckgo using DuckDuckGoSearch class
54- - Ebay using EbaySearch class
54+ - DuckDuckGo using DuckDuckGoSearch class
55+ - eBay using EbaySearch class
5556- Yandex using YandexSearch class
5657- HomeDepot using HomeDepotSearch class
5758- GoogleScholar using GoogleScholarSearch class
@@ -133,7 +134,7 @@ object_result = search.get_object()
133134```
134135[ Link to the full documentation] ( https://serpapi.com/search-api )
135136
136- see below for more hands on examples.
137+ See below for more hands- on examples.
137138
138139### How to set SERP API key
139140
@@ -150,12 +151,12 @@ query = GoogleSearch({"q": "coffee", "serp_api_key": "Your Private Key"})
150151
151152### Example by specification
152153
153- We love true open source, continuous integration and Test Drive Development (TDD).
154- We are using RSpec to test [ our infrastructure around the clock] ( https://travis-ci.org/serpapi/google-search-results-python ) to achieve the best QoS ( Quality Of Service).
154+ We love true open source, continuous integration and Test Driven Development (TDD).
155+ We are using RSpec to test [ our infrastructure around the clock] ( https://travis-ci.org/serpapi/google-search-results-python ) to achieve the best Quality of Service (QoS ).
155156
156157The directory test/ includes specification/examples.
157158
158- Set your api key.
159+ Set your API key.
159160``` bash
160161export API_KEY=" your secret key"
161162```
@@ -174,7 +175,7 @@ location_list = search.get_location("Austin", 3)
174175print (location_list)
175176```
176177
177- it prints the first 3 location matching Austin (Texas, Texas, Rochester)
178+ This prints the first 3 locations matching Austin (Texas, Texas, Rochester).
178179``` python
179180[ { ' canonical_name' : ' Austin,TX,Texas,United States' ,
180181 ' country_code' : ' US' ,
@@ -191,8 +192,8 @@ it prints the first 3 location matching Austin (Texas, Texas, Rochester)
191192
192193### Search Archive API
193194
194- The search result are stored in temporary cached .
195- The previous search can be retrieve from the the cache for free.
195+ The search results are stored in a temporary cache .
196+ The previous search can be retrieved from the cache for free.
196197
197198``` python
198199from serpapi import GoogleSearch
@@ -203,29 +204,29 @@ search_id = search_result.get("search_metadata").get("id")
203204print (search_id)
204205```
205206
206- Now let retrieve the previous search from the archive.
207+ Now let's retrieve the previous search from the archive.
207208
208209``` python
209210archived_search_result = GoogleSearch({}).get_search_archive(search_id, ' json' )
210211print (archived_search_result.get(" search_metadata" ).get(" id" ))
211212```
212- it prints the search result from the archive.
213+ This prints the search result from the archive.
213214
214215### Account API
215216``` python
216217from serpapi import GoogleSearch
217218search = GoogleSearch({})
218219account = search.get_account()
219220```
220- it prints your account information.
221+ This prints your account information.
221222
222223### Search Bing
223224``` python
224225from serpapi import BingSearch
225226search = BingSearch({" q" : " Coffee" , " location" : " Austin,Texas" })
226227data = search.get_dict()
227228```
228- this code prints baidu search results for coffee as a Dictionary.
229+ This code prints Bing search results for coffee as a Dictionary.
229230
230231https://serpapi.com/bing-search-api
231232
@@ -235,7 +236,7 @@ from serpapi import BaiduSearch
235236search = BaiduSearch({" q" : " Coffee" })
236237data = search.get_dict()
237238```
238- this code prints baidu search results for coffee as a Dictionary.
239+ This code prints Baidu search results for coffee as a Dictionary.
239240https://serpapi.com/baidu-search-api
240241
241242### Search Yandex
@@ -244,7 +245,7 @@ from serpapi import YandexSearch
244245search = YandexSearch({" text" : " Coffee" })
245246data = search.get_dict()
246247```
247- this code prints yandex search results for coffee as a Dictionary.
248+ This code prints Yandex search results for coffee as a Dictionary.
248249
249250https://serpapi.com/yandex-search-api
250251
@@ -254,28 +255,28 @@ from serpapi import YahooSearch
254255search = YahooSearch({" p" : " Coffee" })
255256data = search.get_dict()
256257```
257- this code prints yahoo search results for coffee as a Dictionary.
258+ This code prints Yahoo search results for coffee as a Dictionary.
258259
259260https://serpapi.com/yahoo-search-api
260261
261262
262- ### Search Ebay
263+ ### Search eBay
263264``` python
264265from serpapi import EbaySearch
265266search = EbaySearch({" _nkw" : " Coffee" })
266267data = search.get_dict()
267268```
268- this code prints ebay search results for coffee as a Dictionary.
269+ This code prints eBay search results for coffee as a Dictionary.
269270
270271https://serpapi.com/ebay-search-api
271272
272- ### Search Home depot
273+ ### Search Home Depot
273274``` python
274275from serpapi import HomeDepotSearch
275276search = HomeDepotSearch({" q" : " chair" })
276277data = search.get_dict()
277278```
278- this code prints home depot search results for chair as Dictionary.
279+ This code prints Home Depot search results for chair as Dictionary.
279280
280281https://serpapi.com/home-depot-search-api
281282
@@ -285,7 +286,7 @@ from serpapi import HomeDepotSearch
285286search = YoutubeSearch({" q" : " chair" })
286287data = search.get_dict()
287288```
288- this code prints youtube search results for chair as Dictionary.
289+ This code prints Youtube search results for chair as Dictionary.
289290
290291https://serpapi.com/youtube-search-api
291292
@@ -295,39 +296,39 @@ from serpapi import GoogleScholarSearch
295296search = GoogleScholarSearch({" q" : " Coffee" })
296297data = search.get_dict()
297298```
298- this code prints Google Scholar search results.
299+ This code prints Google Scholar search results.
299300
300301### Search Walmart
301302``` python
302303from serpapi import WalmartSearch
303304search = WalmartSearch({" query" : " chair" })
304305data = search.get_dict()
305306```
306- this code prints Google Scholar search results.
307+ This code prints Walmart search results.
307308
308309### Search Youtube
309310``` python
310311from serpapi import YoutubeSearch
311312search = YoutubeSearch({" search_query" : " chair" })
312313data = search.get_dict()
313314```
314- this code prints Google Scholar search results.
315+ This code prints Youtube search results.
315316
316- ### Search Apple Store
317+ ### Search Apple App Store
317318``` python
318319from serpapi import AppleAppStoreSearch
319320search = AppleAppStoreSearch({" term" : " Coffee" })
320321data = search.get_dict()
321322```
322- this code prints Google Scholar search results.
323+ This code prints Apple App Store search results.
323324
324325### Search Naver
325326``` python
326327from serpapi import NaverSearch
327328search = NaverSearch({" query" : " chair" })
328329data = search.get_dict()
329330```
330- this code prints Google Scholar search results.
331+ This code prints Naver search results.
331332
332333### Generic search with SerpApiClient
333334``` python
@@ -336,7 +337,7 @@ query = {"q": "Coffee", "location": "Austin,Texas", "engine": "google"}
336337search = SerpApiClient(query)
337338data = search.get_dict()
338339```
339- This class enables to interact with any search engine supported by SerpApi.com
340+ This class enables interaction with any search engine supported by SerpApi.com
340341
341342### Search Google Images
342343
@@ -352,8 +353,8 @@ for image_result in search.get_dict()['images_results']:
352353 pass
353354```
354355
355- this code prints all the images links,
356- and download image if you un-comment the line with wget (linux/osx tool to download image ).
356+ This code prints all the image links,
357+ and downloads the images if you un-comment the line with wget (Linux/OS X tool to download files ).
357358
358359This tutorial covers more ground on this topic.
359360https://github.com/serpapi/showcase-serpapi-tensorflow-keras-image-training
@@ -375,7 +376,7 @@ for offset in [0,1,2]:
375376 print (str (news_result[' position' ] + offset * 10 ) + " - " + news_result[' title' ])
376377```
377378
378- this script prints the first 3 pages of the news title for the last 24h .
379+ This script prints the first 3 pages of the news headlines for the last 24 hours .
379380
380381### Search Google Shopping
381382
@@ -393,12 +394,12 @@ for shopping_result in data['shopping_results']:
393394
394395```
395396
396- this script prints all the shopping results order by review order.
397+ This script prints all the shopping results, ordered by review order.
397398
398399### Google Search By Location
399400
400- With SerpApi, we can build Google search from anywhere in the world.
401- This code is looking for the best coffee shop per city .
401+ With SerpApi, we can build a Google search from anywhere in the world.
402+ This code looks for the best coffee shop for the given cities .
402403
403404``` python
404405from serpapi import GoogleSearch
@@ -416,9 +417,9 @@ for city in ["new york", "paris", "berlin"]:
416417
417418### Batch Asynchronous Searches
418419
419- We do offer two ways to boost your searches thanks to ` async ` parameter.
420- - Blocking - async=false - it's more compute intensive because the search would need to hold many connections. (default)
421- - Non-blocking - async=true - it's way to go for large amount of query submitted by batch (recommended)
420+ We offer two ways to boost your searches thanks to the ` async ` parameter.
421+ - Blocking - async=false - more compute intensive because the search needs to maintain many connections. (default)
422+ - Non-blocking - async=true - the way to go for large batches of queries (recommended)
422423
423424``` python
424425# Operating system
@@ -489,19 +490,19 @@ print('all searches completed')
489490
490491This code shows how to run searches asynchronously.
491492The search parameters must have {async: True}. This indicates that the client shouldn't wait for the search to be completed.
492- The current thread that executes the search is now non-blocking which allows to execute thousand of searches in seconds. The SerpApi backend will do the processing work.
493- The actual search result is defer to a later call from the search archive using get_search_archive(search_id).
493+ The current thread that executes the search is now non-blocking, which allows it to execute thousands of searches in seconds. The SerpApi backend will do the processing work.
494+ The actual search result is deferred to a later call from the search archive using get_search_archive(search_id).
494495In this example the non-blocking searches are persisted in a queue: search_queue.
495- A loop through the search_queue allows to fetch individual search result .
496- This process can be easily multithreaded to allow a large number of concurrent search requests.
497- To keep thing simple, this example does only explore search result one at a time (single threaded).
496+ A loop through the search_queue allows it to fetch individual search results .
497+ This process can easily be multithreaded to allow a large number of concurrent search requests.
498+ To keep things simple, this example only explores search results one at a time (single threaded).
498499
499500[ See example.] ( https://github.com/serpapi/google-search-results-python/blob/master/tests/test_example.py )
500501
501502### Python object as a result
502503
503504The search results can be automatically wrapped in dynamically generated Python object.
504- This solution offers a more dynamic solution fully Oriented Object Programming approach over the regular Dictionary / JSON data structure.
505+ This solution offers a more dynamic, fully Oriented Object Programming approach over the regular Dictionary / JSON data structure.
505506
506507``` python
507508from serpapi import GoogleSearch
@@ -516,7 +517,7 @@ assert r.search_parameters.engine, "google"
516517```
517518
518519### Pagination using iterator
519- Let's collect links accross multiple search result pages.
520+ Let's collect links across multiple search results pages.
520521``` python
521522# to get 2 pages
522523start = 0
@@ -568,20 +569,20 @@ Examples to fetch links with pagination: [test file](https://github.com/serpapi/
568569
569570### Error management
570571
571- SerpAPI keeps error mangement very basic .
572+ SerpApi keeps error management simple .
572573 - backend service error or search fail
573574 - client error
574575
575- If it's a backend error, a simple message error is returned as string in the server response.
576+ If it's a backend error, a simple error message is returned as string in the server response.
576577``` python
577578from serpapi import GoogleSearch
578579search = GoogleSearch({" q" : " Coffee" , " location" : " Austin,Texas" , " api_key" : " <secret_key>" })
579580data = search.get_json()
580581assert data[" error" ] == None
581582```
582- In some case , there is more details availabel in the data object.
583+ In some cases , there are more details available in the data object.
583584
584- If it's client error, then a SerpApiClientException is raised.
585+ If it's a client error, then a SerpApiClientException is raised.
585586
586587## Change log
5875882021-12-22 @ 2.4.1
0 commit comments