News Catcher API

News

Introducing Newscatcher API

Newscatcher API is a public API that allows you to easily retrieve news articles from all over the web. With its simple syntax and powerful capabilities, this API is a must-have for anyone looking to stay up-to-date on the latest happenings in the world.

Getting Started

To get started with Newscatcher API, you will first need to sign up for an API key. Once you have your key, you can start using the API immediately.

To make requests to the API, you will need to use the following endpoint:

const apiKey = '<Your-API-Key>';
const apiUrl = `https://api.newscatcherapi.com/v2/search?`;

Searching for News Articles

To search for news articles using Newscatcher API, you will need to specify your search query and any relevant parameters. Here is an example of how to search for articles on the topic of "politics":

const query = 'politics';
const params = {
    lang: 'en',
    sort_by: 'relevancy',
    page: 1,
    page_size: 10
};

const searchUrl = `${apiUrl}q=${query}&lang=${params.lang}&sort_by=${params.sort_by}&page=${params.page}&page_size=${params.page_size}&media=True`;

fetch(searchUrl, {headers: {'x-api-key': apiKey}})
    .then((response) => response.json())
    .then((data) => console.log(data))
    .catch((error) => console.log(error));

In the above example, we are searching for news articles that contain the keyword "politics" and are in English. We are also sorting the results by relevancy, and limiting the results to the first page with only 10 articles.

Retrieving Top Headlines

Newscatcher API also allows you to retrieve the top headlines from around the world. Here's an example of how to do that in JavaScript:

const topHeadlinesUrl = `${apiUrl}lang=en&page=1&page_size=10`;

fetch(topHeadlinesUrl, {headers: {'x-api-key': apiKey}})
    .then((response) => response.json())
    .then((data) => console.log(data))
    .catch((error) => console.log(error));

The above example retrieves the top 10 headlines from around the world, sorted by relevancy, and limited to the first page.

Conclusion

Newscatcher API is a powerful tool that allows you to easily retrieve news articles from all over the web. With its simple syntax and powerful capabilities, this API is a must-have for anyone looking to stay up-to-date on the latest happenings in the world. So, what are you waiting for? Sign up for your API key today and start exploring the world of news!

Related APIs in News