@@ -85,37 +85,6 @@ def _wait_request_archive(self, request_id: str) -> dict:
8585 raise Exception ('Timeout exceeded' )
8686
8787 def google_search (self , query : list , pages_per_query : int = 1 , uule = '' , language : str = 'en' , region : str = None , fields : list = None ) -> list :
88- '''
89- Get data from Google search
90-
91- Parameters:
92- query (list | str): parameter defines the query or queries you want to search on Google. Using a lists allows multiple queries (up to 25) to be sent in one request and save on network latency time.
93- pages_per_query (int): parameter specifies the limit of pages to return from one query.
94- uule (str): Google UULE parameter is used to encode a place or an exact location (with latitude and longitude) into a code. By using it you can see a Google result page like someone located at the specified location.
95- language (str): parameter specifies the language to use for Google. Available values: "en", "de", "es", "es-419", "fr", "hr", "it", "nl", "pl", "pt-BR", "pt-PT", "vi", "tr", "ru", "ar", "th", "ko", "zh-CN", "zh-TW", "ja", "ach", "af", "ak", "ig", "az", "ban", "ceb", "xx-bork", "bs", "br", "ca", "cs", "sn", "co", "cy", "da", "yo", "et", "xx-elmer", "eo", "eu", "ee", "tl", "fil", "fo", "fy", "gaa", "ga", "gd", "gl", "gn", "xx-hacker", "ht", "ha", "haw", "bem", "rn", "id", "ia", "xh", "zu", "is", "jw", "rw", "sw", "tlh", "kg", "mfe", "kri", "la", "lv", "to", "lt", "ln", "loz", "lua", "lg", "hu", "mg", "mt", "mi", "ms", "pcm", "no", "nso", "ny", "nn", "uz", "oc", "om", "xx-pirate", "ro", "rm", "qu", "nyn", "crs", "sq", "sk", "sl", "so", "st", "sr-ME", "sr-Latn", "su", "fi", "sv", "tn", "tum", "tk", "tw", "wo", "el", "be", "bg", "ky", "kk", "mk", "mn", "sr", "tt", "tg", "uk", "ka", "hy", "yi", "iw", "ug", "ur", "ps", "sd", "fa", "ckb", "ti", "am", "ne", "mr", "hi", "bn", "pa", "gu", "or", "ta", "te", "kn", "ml", "si", "lo", "my", "km", "chr".
96- region (str): parameter specifies the region to use for Google. Available values: "AF", "AL", "DZ", "AS", "AD", "AO", "AI", "AG", "AR", "AM", "AU", "AT", "AZ", "BS", "BH", "BD", "BY", "BE", "BZ", "BJ", "BT", "BO", "BA", "BW", "BR", "VG", "BN", "BG", "BF", "BI", "KH", "CM", "CA", "CV", "CF", "TD", "CL", "CN", "CO", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "EE", "ET", "FJ", "FI", "FR", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GT", "GG", "GY", "HT", "HN", "HK", "HU", "IS", "IN", "ID", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KW", "KG", "LA", "LV", "LB", "LS", "LY", "LI", "LT", "LU", "MG", "MW", "MY", "MV", "ML", "MT", "MU", "MX", "FM", "MD", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NZ", "NI", "NE", "NG", "NU", "MK", "NO", "OM", "PK", "PS", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RO", "RU", "RW", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SK", "SI", "SB", "SO", "ZA", "KR", "ES", "LK", "SH", "VC", "SR", "SE", "CH", "TW", "TJ", "TZ", "TH", "TL", "TG", "TO", "TT", "TN", "TR", "TM", "VI", "UG", "UA", "AE", "GB", "US", "UY", "UZ", "VU", "VE", "VN", "ZM", "ZW".
97- fields (list): parameter defines which fields you want to include with each item returned in the response. By default, it returns all fields.
98-
99- Returns:
100- list: json result
101-
102- See: https://app.outscraper.com/api-docs#tag/Google-Search/paths/~1google-search-v2/get
103- '''
104- response = requests .get (f'{ self ._api_url } /google-search-v2' , params = {
105- 'query' : as_list (query ),
106- 'pagesPerQuery' : pages_per_query ,
107- 'uule' : uule ,
108- 'language' : language ,
109- 'region' : region ,
110- 'fields' : ',' .join (fields ) if fields else '' ,
111- }, headers = self ._api_headers )
112-
113- if 199 < response .status_code < 300 :
114- return self ._wait_request_archive (response .json ()['id' ]).get ('data' , [])
115-
116- raise Exception (f'Response status code: { response .status_code } ' )
117-
118- def google_search_v3 (self , query : list , pages_per_query : int = 1 , uule = '' , language : str = 'en' , region : str = None , fields : list = None ) -> list :
11988 '''
12089 Get data from Google search
12190
@@ -454,6 +423,9 @@ def google_maps_business_reviews(self, *args, **kwargs) -> list: # deprecated
454423 def google_maps_reviews_v2 (self , * args , ** kwargs ) -> list : # alias
455424 return self .google_maps_reviews (* args , ** kwargs )
456425
426+ def google_search_v3 (self , * args , ** kwargs ) -> list : # alias
427+ return self .google_search (* args , ** kwargs )
428+
457429 def google_play_reviews (self , query : list , reviews_limit : int = 100 , sort : str = 'most_relevant' , cutoff : int = None ,
458430 rating : int = None , language : str = 'en' , fields : list = None
459431 ) -> list :
0 commit comments