Skip to content

Commit

Permalink
added rp-online.de
Browse files Browse the repository at this point in the history
  • Loading branch information
schochastics committed Oct 16, 2024
1 parent a4470ed commit 4d6bfee
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ S3method(pb_deliver_paper,nypost_com)
S3method(pb_deliver_paper,nytimes_com)
S3method(pb_deliver_paper,parlamentnilisty_cz)
S3method(pb_deliver_paper,prosieben_de)
S3method(pb_deliver_paper,rp_online_de)
S3method(pb_deliver_paper,rte_ie)
S3method(pb_deliver_paper,rtl_de)
S3method(pb_deliver_paper,rtl_nl)
Expand Down
25 changes: 25 additions & 0 deletions R/deliver_rp_online_de.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#' @export
pb_deliver_paper.rp_online_de <- function(x, verbose = NULL, pb, ...) {
pb_tick(x, verbose, pb)
# raw html is stored in column content_raw
html <- rvest::read_html(x$content_raw)

json_txt <- rvest::html_nodes(html, "script[type = \"application/ld+json\"] ")[1] %>% rvest::html_text()
json_df <- jsonlite::fromJSON(json_txt)

datetime <- lubridate::as_datetime(json_df$datePublished)
headline <- json_df$headline
author <- toString(json_df$author$name)
text <- html %>%
rvest::html_nodes("strong[data-cy=\"intro\"],div[data-cy=\"article_content\"] p") %>%
rvest::html_text2() %>%
paste(collapse = "\n")

s_n_list(
datetime,
author,
headline,
text,
json_df # dumping the whole json data of an article
)
}
1 change: 1 addition & 0 deletions inst/status.csv
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"pagesix.com","![](https://img.shields.io/badge/status-requested-lightgrey)","","[#1](https://github.com/JBGruber/paperboy/issues/1)",NA
"parlamentnilisty.cz","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@JBGruber](https://github.com/JBGruber/)","","http://www.parlamentnilisty.cz/export/rss.aspx"
"prosieben.de","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@schochastics](https://github.com/schochastics)","[#23](https://github.com/JBGruber/paperboy/issues/23)",NA
"rp-online.de","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@schochastics](https://github.com/schochastics)","[#23](https://github.com/JBGruber/paperboy/issues/23)", "https://rp-online.de/feed.rss"
"rte.ie","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@JBGruber](https://github.com/JBGruber/)","","https://www.rte.ie/feeds/rss/?index=/news/"
"rtl.de","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@schochastics](https://github.com/schochastics)","[#23](https://github.com/JBGruber/paperboy/issues/23)","https://www.rtl.de/rss/feed/news"
"rtl.nl","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@JBGruber](https://github.com/JBGruber/)","","https://www.rtlnieuws.nl/rss.xml"
Expand Down

0 comments on commit 4d6bfee

Please sign in to comment.