pastebin
: Tools to work with the pastebin API
Pastebin is a website where you can store any text online for easy sharing. The website is mainly used by programmers to store pieces of sources code or configuration information, but anyone is more than welcome to paste any type of text. The idea behind the site is to make it more convenient for people to share large amounts of text online.
WIP!! The package API will very likely be in rapid change mode for a bit
The following functions are implemented:
get_paste
: Get raw paste dataget_paste_metadata
: Get paste metadataget_trending_pastes
: Get trending pastesget_recent_pastes
: Get recent pastesnew_paste
: Create a new pastepastebin_api_key
: Get or set PASTEBIN_API_KEY
valuetoString.paste
: Extract just the paste text from a paste objectas.character.paste
: Extract just the paste text from a paste objectIf you want the impersonate
parameter of new_paste()
to work you must set PASTEBIN_USER
and PASTEBIN_PASSWORD
(preferably in ~/.Renviron
).
devtools::install_github("hrbrmstr/pastebin")
options(width=120)
library(pastebin) library(tidyverse) # current verison packageVersion("pastebin") get_trending_pastes() %>% arrange(desc(hits)) r_pastes <- get_recent_pastes(lang="rsplus") glimpse(r_pastes)
Can't always trust the lang
setting. Some non-R stuff in there:
walk(r_pastes$key[1:10], ~print(toString(get_paste(.))))
Since the user is obvious:
mebbe_r <- filter(r_pastes, user != "AllRls_net") walk(mebbe_r$key, ~print(toString(get_paste(.))))
library(pastebin) library(testthat) date() test_dir("tests/")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.