2

Is there any way to get RSS feed from various websites (e.g. Google News) in R, and display them in an R shiny interface?

I've tried using the feedeR library, but it doesn't work... Here's my code:

library(feedeR)    
feed.extract("news.google.com/search?q=Boston&hl=en&ie=utf-8&num=100&output=rss")

I'm getting the following error message:

Error: XML content does not seem to be XML: ''
user12205
  • 2,684
  • 1
  • 20
  • 40
Anass D.
  • 21
  • 1

1 Answers1

0

You got the RSS link wrong. The correct format for a search by query is https://news.google.com/rss/search?q={query}.

Here's a good answer explaining the format of Google News RSS search queries: https://stackoverflow.com/a/51537262

In your case this will work:

library(feedeR)  
myquery <- feed.extract("https://news.google.com/rss/search?q=Boston")

The other arguments that you gave in the question are default anyway.

For having a structured dataframe use this:

data.frame(myquery$items)

Or if you like the library(tidyverse):

myquery$items %>% as_tibble()
Martin
  • 1,141
  • 14
  • 24