Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yutannihilation/mediumr
R Interface to Medium API
https://github.com/yutannihilation/mediumr
Last synced: 2 months ago
JSON representation
R Interface to Medium API
- Host: GitHub
- URL: https://github.com/yutannihilation/mediumr
- Owner: yutannihilation
- License: other
- Created: 2017-10-25T13:53:00.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-08T12:24:13.000Z (about 7 years ago)
- Last Synced: 2024-08-03T11:01:34.531Z (4 months ago)
- Language: R
- Size: 431 KB
- Stars: 22
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rmarkdown - mediumr: R Interface to Medium API
README
# mediumr
[![Travis build status](https://travis-ci.org/yutannihilation/mediumr.svg?branch=master)](https://travis-ci.org/yutannihilation/mediumr)
R Interface to [Medium API](https://github.com/Medium/medium-api-docs).
## Installation
You can install mediumr from github with:
``` r
# install.packages("devtools")
devtools::install_github("yutannihilation/mediumr")
```## Addin
Using "Post to Medium" addin, you can post Rmd file to Medium directly:
![](man/figures/screenshot_addin.png)
![](man/figures/screenshot.png)
![](man/figures/screenshot_medium.png)
## Other Usages
### Authentication
Issue an API token and set it as an environmental variable `MEDIUM_API_TOKEN`. You should add this line in your `.Renviron`:
```
MEDIUM_API_TOKEN=''
```### Get Current User
```r
library(mediumr)medium_get_current_user()
#> $id
#> [1] "5303d74c64f66366f00cb9b2a94f3251bf5"
#>
#> $username
#> [1] "majelbstoat"
#>
#> $name
#> [1] "Jamie Talbot"
#>
#> $url
#> [1] "https://medium.com/@majelbstoat"
#>
#> $imageUrl
#> [1] "https://images.medium.com/0*fkfQiTzT7TlUGGyI.png"
```### Create A Post
````r
content <- "
# test1. test1
2. test2```r
this <- is(test)
```
"
medium_create_post("test", content = content)
````### Upload An Image
```r
medium_upload_image("/path/to/image.png")
```## Limitations
* Since Medium doesn't provide update API, you cannot update existing posts via mediumr.
* Medium doesn't support tables. So, it makes little sense to use `knitr::kabble()` or `formattable::formattable()` for printing data.frames.