VOOZH about

URL: https://www.geeksforgeeks.org/r-language/get-news-from-newsapi-using-r-language/

⇱ Get news from newsapi using R language - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Get news from newsapi using R language

Last Updated : 23 Jul, 2025

In this article, we will learn how to create a Rscript to read the latest news. We will be using news API to get news and extract it using httr package in R Programming Language.

Modules Needed:

install.packages("httr")

install.packages("jsonlite")

Get news API:

To get your API key visit newsapi.org and create your account. 

👁 Image

Click on the Get API key to get your key.  Make sure you have saved your key.

We will be using httr GET() to make URL requests and store news data in a variable. Now we will need JSON data so we have to convert the news data into char format because GET() returns raw data so we will need to use rawToChar() and to convert char data in JSON format we will be using from JSON() built-in jsonlite package.

Implementation:

Make sure to replace <YOURAPIKEY> with your API key in url.

Output:

👁 Image
Comment

Explore