knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of newspaper is to extract contents from Newspaper's website.
You can install the released version of newspaper from Github with:
# install.packages("remotes") remotes::install_github("forkonlp/newspaper")
This is a basic example which shows you how to solve a common problem:
library(newspaper) library(stringr) news <- np_news("http://www.segye.com/newsView/20190624511168") news news$title news$from news$published_at news$edited_at news$by news$body %>% str_wrap(80) %>% cat()
library(tibble) library(purrr) target %>% iwalk( ~ {print(.) purrr::safely(np_news)(.x) %>% purrr::when( is.null(.$result) ~ invisible(.), ~ .$result %>% glimpse() )} )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.