Access local and world news.

Repository Reference

Installation

You can install accunews with remotes from Github, see changes.

# install.packages("remotes")
remotes::install_github("news-r/accunews") # github

Setup

Get a free key from the accunewsapp.com website.

accunews_key("xxXXxxXx")

Note that you can specify the ACCUNEWS_API_KEY key as an environment variable in your .Renviron for convenience.

Examples

library(accunews)
#> API key loaded!

# get business news sources
(src <- acc_world_sources(type = "business", pages = 2))
#> ❯ Crawling page 1
#> ❯ Crawling page 2
#> # A tibble: 56 x 17
#>    name  parent_name homepage   lat    lon address icon  type  phone
#>    <chr> <chr>       <chr>    <dbl>  <dbl> <chr>   <chr> <chr> <chr>
#>  1 Reut… Thomson Re… www.reu…  43.7  -79.4 333 Ba… http… WEB   +1 6…
#>  2 Forb… Forbes Med… www.for…  40.7  -74.0 499 Wa… http… WEB   (800…
#>  3 Free  Vice Media… free.vi…  40.7  -74.0 49 S 2… http… WEB   (718…
#>  4 Mark… Dow Jones … www.mar…  37.8 -122.  201 Ca… http… WEB   415-…
#>  5 The … Dow Jones … www.wsj…  40.8  -74.0 1211 A… http… WEB   1-80…
#>  6 Wash… The Washin… www.was…  38.9  -77.0 1301 K… http… WEB   202.…
#>  7 Bloo… Bloomberg … www.blo…  40.8  -74.0 731 Le… http… WEB   1 (4…
#>  8 Entr… Entreprene… www.ent…  33.7 -118.  18061 … http… WEB   (949…
#>  9 NPR.… National P… www.npr…  38.9  -77.0 1111 N… http… WEB   1 (2…
#> 10 Barr… Dow Jones … www.bar…  38.9  -77.0 1025 C… http… WEB   1-80…
#> # … with 46 more rows, and 8 more variables: description <chr>,
#> #   facebook <chr>, twitter <chr>, instagram <chr>, youtube <chr>,
#> #   email <chr>, snapchat <chr>, pinterest <chr>

Plot with echarts4r.

library(echarts4r.suite)
#> ── Attaching echarts4r.suite ───────────────────── echarts4r.suite 0.0.1 ──
#> ✔ echarts4r        0.2.3     ✔ echarts4r.assets 0.0.1
#> ✔ echarts4r.maps   0.0.2

src %>% 
  e_charts(lon) %>% 
  em_map("USA") %>%
  e_geo("USA") %>% 
  e_scatter(
    lat,
    bind = name,
    symbol_size = 10,
    symbol = ea_icons("signals"),
    legend = FALSE,
    coord_system = "geo"
  ) %>%
  e_tooltip() %>%  
  e_color(
    "#247BA0",
    "#f9f7f1"
  )

You can also look for local news.

library(accunews)

# get articles local (to somewhere)
acc_local_articles(27.964157, -82.452606, pages = 2)
#> ❯ Crawling page 1
#> ❯ Crawling page 2
#> # A tibble: 200 x 12
#>    title link  time  image summary readtime source_name source_icon
#>    <chr> <chr> <chr> <chr> <chr>   <chr>    <chr>       <chr>      
#>  1 Pare… http… 2019… http… ""      <NA>     WFLA        http://www…
#>  2 Hump… http… 2019… http… "- A w… 1 min r… FOX 13 NEWS http://www…
#>  3 Two … http… 2019… http… "TAMPA… 1 min r… WFLA        http://www…
#>  4 Ecke… http… 2019… http… "- It … 1 min r… FOX 13 NEWS http://www…
#>  5 TxDO… http… 2019… http… "TAMPA… 1 min r… WFLA        http://www…
#>  6 Gato… http… 2019… http… "Copyr… 1 min r… WFLA        https://ww…
#>  7 Stat… http… 2019… http… "Copyr… 1 min r… WFLA        http://www…
#>  8 Clic… http… 2019… http… "HILLS… 1 min r… WFLA        http://www…
#>  9 'Cli… http… 2019… http… "Previ… 1 min r… WFLA        http://www…
#> 10 NBC'… http… 2019… http… "\"Thi… 1 min r… WFLA        https://ww…
#> # … with 190 more rows, and 4 more variables: source_type <chr>,
#> #   source_lat <dbl>, source_lon <dbl>, source_address <chr>