RobertMyles / tidyRSS

An R package for extracting 'tidy' data frames from RSS, Atom and JSON feeds
https://robertmyles.github.io/tidyRSS/
Other
82 stars 20 forks source link

item_title with more entries then item_description #69

Closed tombroekel closed 1 year ago

tombroekel commented 1 year ago

Hi, an error occurs when applying tidyfeed() to the following feed: "https://feed.ksta.de/feed/rss/index.rss". The reason seems to be that in rss_parse() the creation of the object "entries" as a tibble is done such that item_title and item_description need to have the same number of entries. However, this does not seem to be the case for all feeds. The problem is the transformation via unlist(), which does not preserve the length of the original list object created by map(). A possible solution is to pipe the item_description (or any other) object at this stage into the following function: replace_null <- function(x){
x <- purrr::map(x, ~ replace(.x, is.null(.x), NAcharacter)) purrr::map(x, ~ if(is.list(.x)) replace_null(.x) else .x) } But there might be a more efficient way!

RobertMyles commented 1 year ago

Thanks Tom, I'll take a look at that asap.

RobertMyles commented 1 year ago

I've added that in to the package, Tom, thank you. I'll add you as a contributor.