Skip to content

Commit 2f58c69

Browse files
DataUrbanEconGeekRosa
andauthored
Adding Capterra reviews (#20)
Co-authored-by: Rosa <arosa@harriswilliams.com>
1 parent 28b0132 commit 2f58c69

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

outscraper/api_client.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,3 +961,46 @@ def glassdoor_reviews(self, query: Union[list, str], limit: int = 100, sort: str
961961
}, headers=self._api_headers)
962962

963963
return self._handle_response(response, wait_async, async_request)
964+
965+
def capterra_reviews(self, query: Union[list, str], limit: int = 100, sort: str = 'MOST_HELPFUL', cutoff: int = None,
966+
language: str = 'en', region: str = None, fields: Union[list, str] = None, async_request: bool = False,
967+
ui: bool = None, webhook: str = None
968+
) -> list:
969+
'''
970+
Returns reviews from Capterra.
971+
972+
Parameters:
973+
query (list | str): Links to Capterra product pages (e.g., 'https://www.capterra.com/p/228041/Google-Maps-scraper/). Using a lists allows multiple queries (up to 250) to be sent in one request and save on network latency time.
974+
limit (int): parameter specifies the limit of reviews to get from one query.
975+
sort (str): parameter specifies one of the sorting types. Available values: "MOST_HELPFUL", "MOST_RECENT", "HIGHEST_RATING", "LOWEST_RATING".
976+
cutoff (int): parameter specifies the oldest timestamp value for items. Using the cutoff parameter overwrites sort parameter. Therefore, the latest records will be at the beginning (newest first).
977+
language (str): parameter specifies the language to use for website. 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".
978+
region (str): parameter specifies the country to use for website. It's recommended to use it for a better search experience. 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", "MQ", "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".
979+
fields (list | str): parameter defines which fields you want to include with each item returned in the response. By default, it returns all fields.
980+
async_request (bool): parameter defines the way you want to submit your task to Outscraper. It can be set to `False` (default) to send a task and wait until you got your results, or `True` to submit your task and retrieve the results later using a request ID with `get_request_archive`. Each response is available for `2` hours after a request has been completed.
981+
ui (bool): parameter defines whether a task will be executed as a UI task. This is commonly used when you want to create a regular platform task with API. Using this parameter overwrites the async_request parameter to `True`.
982+
webhook (str): parameter defines the URL address (callback) to which Outscraper will create a POST request with a JSON body once a task/request is finished. Using this parameter overwrites the webhook from integrations.
983+
984+
Returns:
985+
list: json result
986+
987+
See: https://app.outscraper.com/api-docs#tag/Capterra/paths/~1capterra-reviews/get
988+
'''
989+
990+
queries = as_list(query)
991+
wait_async = async_request or limit > 499 or len(queries) > 10
992+
993+
response = requests.get(f'{self._api_url}/glassdoor/reviews', params={
994+
'query': queries,
995+
'limit': limit,
996+
'sort': sort,
997+
'cutoff': cutoff,
998+
'language': language,
999+
'region': region,
1000+
'async': wait_async,
1001+
'fields': parse_fields(fields),
1002+
'ui': ui,
1003+
'webhook': webhook,
1004+
}, headers=self._api_headers)
1005+
1006+
return self._handle_response(response, wait_async, async_request)

0 commit comments

Comments
 (0)