Our SDK documentation provides comprehensive guidance and examples for developers to seamlessly integrate our project's functionality into their applications.
Python
Requirements
Python >=3.7
Installation
pip install newscatcherapi-python-sdk==6.0.2
from pprint import pprintfrom newscatcherapi_client import Newscatcher, ApiExceptionnewscatcher =Newscatcher( api_key="API_KEY",)try:# [Get] Search Article Request get_response = newscatcher.search.get( q="raises AND series A", search_in="title_content" )print(get_response)except ApiException as e:print("Exception when calling SearchApi.get: %s\n"% e)pprint(e.body)if e.status ==422:pprint(e.body["detail"])pprint(e.headers)pprint(e.status)pprint(e.reason)pprint(e.round_trip_time)
importcom.konfigthis.newscatcherapi.client.ApiClient;importcom.konfigthis.newscatcherapi.client.ApiException;importcom.konfigthis.newscatcherapi.client.ApiResponse;importcom.konfigthis.newscatcherapi.client.Newscatcher;importcom.konfigthis.newscatcherapi.client.Configuration;importcom.konfigthis.newscatcherapi.client.auth.*;importcom.konfigthis.newscatcherapi.client.model.*;importcom.konfigthis.newscatcherapi.client.api.SearchApi;importjava.util.List;importjava.util.Map;importjava.util.UUID;publicclassExample {publicstaticvoidmain(String[] args) {Configuration configuration =newConfiguration();configuration.host="https://v3-api.newscatcherapi.com";configuration.apiKey="YOUR API KEY";Newscatcher client =newNewscatcher(configuration);String q ="raises AND series A";String searchIn ="title_content";Object predefinedSources =null;try {CSearchResponse result = client.search.get(q).searchIn(searchIn).execute();System.out.println(result);System.out.println(result.getStatus());System.out.println(result.getTotalHits());System.out.println(result.getPage());System.out.println(result.getTotalPages());System.out.println(result.getPageSize());System.out.println(result.getArticles());System.out.println(result.getUserInput());System.out.println(result.getClustersCount());System.out.println(result.getClusters()); } catch (ApiException e) {System.err.println("Exception when calling SearchApi#get");System.err.println("Status code: "+e.getStatusCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace(); } }}
Typescript
Installation
npm
npm i newscatcherapi-typescript-sdk
pnpm
pnpm i newscatcherapi-typescript-sdk
yarn
yarn add newscatcherapi-typescript-sdk
import { Newscatcher } from"newscatcherapi-typescript-sdk";constnewscatcher=newNewscatcher({// Defining the base path is optional and defaults to https://v3-api.newscatcherapi.com// basePath: "https://v3-api.newscatcherapi.com", apiKey:"API_KEY",});constgetResponse=awaitnewscatcher.search.get({ q:"raises AND series A", searchIn:"title_content", byParseDate:false, sortBy:"relevancy", page:1, pageSize:100,});