Skip to content

Commit

Permalink
added t-online.de
Browse files Browse the repository at this point in the history
  • Loading branch information
schochastics committed Oct 16, 2024
1 parent 4d6bfee commit bc7ba88
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ S3method(pb_deliver_paper,sky_com)
S3method(pb_deliver_paper,spiegel_de)
S3method(pb_deliver_paper,stern_de)
S3method(pb_deliver_paper,sueddeutsche_de)
S3method(pb_deliver_paper,t_online_de)
S3method(pb_deliver_paper,tagesschau_de)
S3method(pb_deliver_paper,telegraaf_nl)
S3method(pb_deliver_paper,telegraph_co_uk)
Expand Down
26 changes: 26 additions & 0 deletions R/deliver_t_online_de.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#' @export
pb_deliver_paper.t_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)
json_df <- json_df$`@graph`[1, ]

datetime <- lubridate::as_datetime(json_df$datePublished)
headline <- json_df$headline
author <- toString(json_df$author[[1]]$name)
text <- html %>%
rvest::html_nodes("div[data-testid=\"ArticleBody.StreamLayout\"] 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 @@ -82,6 +82,7 @@
"thismorningwithgordondeal.com","![](https://img.shields.io/badge/status-requested-lightgrey)","","[#1](https://github.com/JBGruber/paperboy/issues/1)",NA
"time.com","![](https://img.shields.io/badge/status-requested-lightgrey)","","[#1](https://github.com/JBGruber/paperboy/issues/1)",NA
"tribpub.com","![](https://img.shields.io/badge/status-requested-lightgrey)","","[#1](https://github.com/JBGruber/paperboy/issues/1)",NA
"t-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://www.t-online.de/nachrichten/feed.rss"
"us.cnn.com","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@JBGruber](https://github.com/JBGruber/)","",NA
"usatoday.com","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@JBGruber](https://github.com/JBGruber/)","",NA
"volkskrant.nl","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@JBGruber](https://github.com/JBGruber/)","","https://www.volkskrant.nl/rss.xml"
Expand Down

0 comments on commit bc7ba88

Please sign in to comment.