knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

twitterbot

R-CMD-check

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.

This package accesses documents from open archives and tweets the latest scientific publications of your team (see it in action: \@archeosciences).

Installation

You you can install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("crp2a/twitterbot")

Usage

library(twitterbot)

twitterbot currently supports:

You can schedule a cron job with cronR or use GitHub actions to schedule tweets on a daily basis.

Tweet your latest publications

## Set the path of the log file
## This file ensures that no document is tweeted twice
path <- file.path(Sys.getenv("HOME"), "hal.log")

## Get documents from HAL
hal <- get_hal_team(id = "399901", limit = 100)

## Post the last ten publications
post(hal, log = path, select = 1:10)
hal <- get_hal_team(id = "399901", limit = 10)
tweet <- compose(hal[[10]])
attributes(tweet) <- NULL

r tweet

Tweet news from your website

## Set the path of the log file
## This file ensures that no document is tweeted twice
path <- file.path(Sys.getenv("HOME"), "rss.log")

## Get news items
url <- "https://www.archeosciences-bordeaux.fr/spip.php?page=backend-breves"
rss <- get_rss(feed = url)

## Post the last ten items
post(rss, log = path, select = 1:10)
url <- "https://www.archeosciences-bordeaux.fr/spip.php?page=backend-breves"
rss <- get_rss(feed = url, limit = 90 * 24 * 60 * 60)
tweet <- compose(rss[[1]])
attributes(tweet) <- NULL

r tweet

Code of Conduct

Please note that the twitterbot project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.



nfrerebeau/twitterbot documentation built on Jan. 30, 2023, 1:12 p.m.