@@ -25,8 +25,8 @@ pip install google-search-results
2525## Quick start
2626
2727``` python
28- from serpapi import GoogleSearchResults
29- search = GoogleSearchResults ({
28+ from serpapi import GoogleSearch
29+ search = GoogleSearch ({
3030 " q" : " coffee" ,
3131 " location" : " Austin,Texas" ,
3232 " api_key" : " <your secret api key>"
@@ -40,19 +40,19 @@ The SerpApi service (backend)
4040- searches on Google using the search: q = "coffee"
4141- parses the messy HTML responses
4242- return a standardizes JSON response
43- The GoogleSearchResults class
43+ The GoogleSearch class
4444- Format the request
4545- Execute GET http request against SerpApi service
4646- Parse JSON response into a dictionary
4747Et voila..
4848
4949Alternatively, you can search:
50- - Bing using BingSearchResults class
51- - Baidu using BaiduSearchResults class
52- - Yahoo using YahooSearchResults class
53- - Ebay using EbaySearchResults class
54- - Yandex using YandexSearchResults class
55- - GoogleScholar using GoogleScholarSearchResults class
50+ - Bing using BingSearch class
51+ - Baidu using BaiduSearch class
52+ - Yahoo using YahooSearch class
53+ - Ebay using EbaySearch class
54+ - Yandex using YandexSearch class
55+ - GoogleScholar using GoogleScholarSearch class
5656
5757See the [ playground to generate your code.] ( https://serpapi.com/playground )
5858
@@ -106,7 +106,7 @@ params = {
106106}
107107
108108# define the search search
109- search = GoogleSearchResults (params)
109+ search = GoogleSearch (params)
110110# override an existing parameter
111111search.params_dict[" location" ] = " Portland"
112112# search format return as raw html
@@ -125,11 +125,11 @@ You can get an API key here if you don't already have one: https://serpapi.com/u
125125
126126The SerpApi ` api_key ` can be set globally:
127127``` python
128- GoogleSearchResults .SERP_API_KEY = " Your Private Key"
128+ GoogleSearch .SERP_API_KEY = " Your Private Key"
129129```
130130The SerpApi ` api_key ` can be provided for each search:
131131``` python
132- query = GoogleSearchResults ({" q" : " coffee" , " serp_api_key" : " Your Private Key" })
132+ query = GoogleSearch ({" q" : " coffee" , " serp_api_key" : " Your Private Key" })
133133```
134134
135135### Example by specification
@@ -152,8 +152,8 @@ make test
152152### Location API
153153
154154``` python
155- from serpapi import GoogleSearchResults
156- search = GoogleSearchResults ({})
155+ from serpapi import GoogleSearch
156+ search = GoogleSearch ({})
157157location_list = search.get_location(" Austin" , 3 )
158158print (location_list)
159159```
@@ -179,8 +179,8 @@ The search result are stored in temporary cached.
179179The previous search can be retrieve from the the cache for free.
180180
181181``` python
182- from serpapi import GoogleSearchResults
183- search = GoogleSearchResults ({" q" : " Coffee" , " location" : " Austin,Texas" })
182+ from serpapi import GoogleSearch
183+ search = GoogleSearch ({" q" : " Coffee" , " location" : " Austin,Texas" })
184184search_result = search.get_dictionary()
185185search_id = search_result.get(" search_metadata" ).get(" id" )
186186print (search_id)
@@ -189,23 +189,23 @@ print(search_id)
189189Now let retrieve the previous search from the archive.
190190
191191``` python
192- archived_search_result = GoogleSearchResults ({}).get_search_archive(search_id, ' json' )
192+ archived_search_result = GoogleSearch ({}).get_search_archive(search_id, ' json' )
193193print (archived_search_result.get(" search_metadata" ).get(" id" ))
194194```
195195it prints the search result from the archive.
196196
197197### Account API
198198``` python
199- from serpapi import GoogleSearchResults
200- search = GoogleSearchResults ({})
199+ from serpapi import GoogleSearch
200+ search = GoogleSearch ({})
201201account = search.get_account()
202202```
203203it prints your account information.
204204
205205### Search Bing
206206``` python
207- from serpapi import BingSearchResults
208- search = BingSearchResults ({" q" : " Coffee" , " location" : " Austin,Texas" })
207+ from serpapi import BingSearch
208+ search = BingSearch ({" q" : " Coffee" , " location" : " Austin,Texas" })
209209data = search.get_json()
210210```
211211this code prints baidu search results for coffee as JSON.
@@ -214,17 +214,17 @@ https://serpapi.com/bing-search-api
214214
215215### Search Baidu
216216``` python
217- from serpapi import BaiduSearchResults
218- search = BaiduSearchResults ({" q" : " Coffee" })
217+ from serpapi import BaiduSearch
218+ search = BaiduSearch ({" q" : " Coffee" })
219219data = search.get_json()
220220```
221221this code prints baidu search results for coffee as JSON.
222222https://serpapi.com/baidu-search-api
223223
224224### Search Yandex
225225``` python
226- from serpapi import YandexSearchResults
227- search = YandexSearchResults ({" text" : " Coffee" })
226+ from serpapi import YandexSearch
227+ search = YandexSearch ({" text" : " Coffee" })
228228data = search.get_json()
229229```
230230this code prints yandex search results for coffee as JSON.
@@ -233,8 +233,8 @@ https://serpapi.com/yandex-search-api
233233
234234### Search Yahoo
235235``` python
236- from serpapi import YahooSearchResults
237- search = YahooSearchResults ({" p" : " Coffee" })
236+ from serpapi import YahooSearch
237+ search = YahooSearch ({" p" : " Coffee" })
238238data = search.get_json()
239239```
240240this code prints yahoo search results for coffee as JSON.
@@ -244,8 +244,8 @@ https://serpapi.com/yahoo-search-api
244244
245245### Search Ebay
246246``` python
247- from serpapi import EbaySearchResults
248- search = EbaySearchResults ({" _nkw" : " Coffee" })
247+ from serpapi import EbaySearch
248+ search = EbaySearch ({" _nkw" : " Coffee" })
249249data = search.get_json()
250250```
251251this code prints ebay search results for coffee as JSON.
@@ -254,8 +254,8 @@ https://serpapi.com/ebay-search-api
254254
255255### Search Google Scholar
256256``` python
257- from serpapi import GoogleScholarSearchResults
258- search = GoogleScholarSearchResults ({" q" : " Coffee" })
257+ from serpapi import GoogleScholarSearch
258+ search = GoogleScholarSearch ({" q" : " Coffee" })
259259data = search.get_json()
260260```
261261this code prints Google Scholar search results.
@@ -272,8 +272,8 @@ This class enables to interact with any search engine supported by SerpApi.com
272272### Search Google Images
273273
274274``` python
275- from serpapi import GoogleSearchResults
276- search = GoogleSearchResults ({" q" : " coffe" , " tbm" : " isch" })
275+ from serpapi import GoogleSearch
276+ search = GoogleSearch ({" q" : " coffe" , " tbm" : " isch" })
277277for image_result in search.get_json()[' images_results' ]:
278278 link = image_result[" original" ]
279279 try :
@@ -292,8 +292,8 @@ https://github.com/serpapi/showcase-serpapi-tensorflow-keras-image-training
292292### Search Google News
293293
294294``` python
295- from serpapi import GoogleSearchResults
296- search = GoogleSearchResults ({
295+ from serpapi import GoogleSearch
296+ search = GoogleSearch ({
297297 " q" : " coffe" , # search search
298298 " tbm" : " nws" , # news
299299 " tbs" : " qdr:d" , # last 24h
@@ -311,8 +311,8 @@ this script prints the first 3 pages of the news title for the last 24h.
311311### Search Google Shopping
312312
313313``` python
314- from serpapi import GoogleSearchResults
315- search = GoogleSearchResults ({
314+ from serpapi import GoogleSearch
315+ search = GoogleSearch ({
316316 " q" : " coffe" , # search search
317317 " tbm" : " shop" , # news
318318 " tbs" : " p_ord:rv" , # last 24h
@@ -332,10 +332,10 @@ With SerpApi, we can build Google search from anywhere in the world.
332332This code is looking for the best coffee shop per city.
333333
334334``` python
335- from serpapi import GoogleSearchResults
335+ from serpapi import GoogleSearch
336336for city in [" new york" , " paris" , " berlin" ]:
337- location = GoogleSearchResults ({}).get_location(city, 1 )[0 ][" canonical_name" ]
338- search = GoogleSearchResults ({
337+ location = GoogleSearch ({}).get_location(city, 1 )[0 ][" canonical_name" ]
338+ search = GoogleSearch ({
339339 " q" : " best coffee shop" , # search search
340340 " location" : location,
341341 " num" : 1 ,
@@ -368,13 +368,13 @@ from queue import Queue
368368import time
369369
370370# SerpApi search
371- from serpapi import GoogleSearchResults
371+ from serpapi import GoogleSearch
372372
373373# store searches
374374search_queue = Queue()
375375
376376# SerpApi search
377- search = GoogleSearchResults ({
377+ search = GoogleSearch ({
378378 " location" : " Austin,Texas" ,
379379 " async" : True
380380})
@@ -391,7 +391,7 @@ for company in ['amd','nvidia','intel']:
391391print (" wait until all search statuses are cached or success" )
392392
393393# Create regular search
394- search = GoogleSearchResults ({" async" : True })
394+ search = GoogleSearch ({" async" : True })
395395while not search_queue.empty():
396396 search = search_queue.get()
397397 search_id = search[' search_metadata' ][' id' ]
@@ -428,6 +428,9 @@ To keep thing simple, this example does only explore search result one at a time
428428[ See example.] ( https://github.com/serpapi/google-search-results-python/blob/master/tests/test_example.py )
429429
430430## Change log
431+ 2020-10-26 @ 2.0.0
432+ - Reduce class name to <engine >Search
433+ - Add get_raw_json
4314342020-06-30 @ 1.8.3
432435 - simplify import
433436 - improve package for python 3.5+
@@ -438,7 +441,7 @@ To keep thing simple, this example does only explore search result one at a time
4384412019-11-10 @ 1.7.1
439442 - increase engine parameter priority over engine value set in the class
4404432019-09-12 @ 1.7
441- - Change namespace "from lib." instead: "from serpapi import GoogleSearchResults "
444+ - Change namespace "from lib." instead: "from serpapi import GoogleSearch "
442445 - Support for Bing and Baidu
4434462019-06-25 @ 1.6
444447 - New search engine supported: Baidu and Bing
0 commit comments