yufree / daily

News/Blog aggregator website for R
https://dailyr.netlify.app
MIT License
15 stars 8 forks source link
blogdown r rss-aggregator

Daily RSS

Daily News/Blog aggregator website and you could use this website as a template to create you own public rss daily reader by adding you own rss addresses collection in R/list.txt . Daily R is a light news/blog aggregator website for R.

Features

Contribute

if (!dir.exists("content")) dir.create("content")
if (!dir.exists("content/post")) dir.create("content/post")
x <- scifetch::getrss('path-to-your-own-rss-xml-files')
for (i in 1:NROW(x)) {
    name = gsub("^http[s]?://|/$", "", tolower(x[i, 'linkTitle']))
    name = gsub("%", "", name)
    name = gsub("[^a-z0-9]+", "-", name)
    name = gsub("--+", "-", name)
    # file name too long issue
    name = substr(name, 1, 200)
    p = sprintf('content/post/%s.md', paste0(name))

    sink(p)
    cat('---\n')
    cat(yaml::as.yaml(x[i,],))
    cat('disable_comments: true\n')
    cat('---\n')
    cat(as.character(x[i, 5]))
    sink()
}

Recipe