Skip to content

Commit

Permalink
added sueddeutsche
Browse files Browse the repository at this point in the history
  • Loading branch information
schochastics committed Oct 15, 2024
1 parent 90a91c2 commit 16d5783
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ S3method(pb_deliver_paper,skwawkbox_org)
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,tagesschau_de)
S3method(pb_deliver_paper,telegraaf_nl)
S3method(pb_deliver_paper,telegraph_co_uk)
Expand Down
22 changes: 22 additions & 0 deletions R/deliver_sueddeutsche.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#' @export
pb_deliver_paper.sueddeutsche_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 <- json_df$articleBody

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 @@ -65,6 +65,7 @@
"sky.com","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@JBGruber](https://github.com/JBGruber/)","","https://feeds.skynews.com/feeds/rss/home.xml"
"spiegel.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.spiegel.de/schlagzeilen/index.rss"
"stern.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.stern.de/feed/standard/all/"
"sueddeutsche.de","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@schochastics](https://github.com/schochastics)","[#23](https://github.com/JBGruber/paperboy/issues/23)","https://rss.sueddeutsche.de/alles"
"tagesschau.de","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@schochastics](https://github.com/schochastics)","[#23](https://github.com/JBGruber/paperboy/issues/23)",NA
"telegraaf.nl","![](https://img.shields.io/badge/status-silver-%23C0C0C0.svg)","[@JBGruber](https://github.com/JBGruber/)","[#17](https://github.com/JBGruber/paperboy/issues/17)","https://www.telegraaf.nl/rss.xml"
"telegraph.co.uk","![](https://img.shields.io/badge/status-gold-%23ffd700.svg)","[@JBGruber](https://github.com/JBGruber/)","",NA
Expand Down

0 comments on commit 16d5783

Please sign in to comment.