MyNixOS website logo
Description

'Leanpub' API Interface.

Provides access to the 'Leanpub' API <https://leanpub.com/help/api> for gathering information about publications and submissions to the 'Leanpub' platform.

R-CMD-check

leanpubr Package:

The goal of leanpubr is to provide provides access to the ‘Leanpub’ ‘API’ https://leanpub.com/help/api for gathering information about publications and submissions to the ‘Leanpub’ platform.

Installation

You can install leanpubr from GitHub with:

# install.packages("remotes")
remotes::install_github("muschellij2/leanpubr")

Setting the API key

The main thing you need to do is get an API key from Leanpub. You can do this by visiting https://leanpub.com/user_dashboard/api_key if you are an author. If you are not an author, I don’t believe access to the API is possible. You can pass this api_key to functions in Leanpub (almost all prefixed by lp_), or you can set the environmental variable LEANPUB_API_KEY. You can set this in an interactive R session such as:

Sys.setenv("LEANPUB_API_KEY" = "YOUR_KEY")

or put this in your ~/.Renviron:

LEANPUB_API_KEY = "YOUR_KEY"

Example

You can use lp_book_info to get information about any book in Leanpub:

library(leanpubr)
slug = "biostatmethods"
res = lp_book_info(slug, error = FALSE, verbose = TRUE)
#> GET command is:
#> Response [https://leanpub.com/login]
#>   Date: 2025-04-01 15:44
#>   Status: 200
#>   Content-Type: text/html; charset=utf-8
#>   Size: 25.4 kB
#> <!DOCTYPE html>
#> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
#> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
#> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
#> <!--[if gt IE 9]><!--><html class="no-js" lang="en"><!--<![endif]--><head>
#> <meta content='IE=edge' http-equiv='X-UA-Compatible'>
#> <meta charset='utf-8'>
#> <meta content='width=device-width, initial-scale=1.0, maximum-scale=1, user-s...
#> <meta content='en' name='Content-Language'>
#> <link rel="apple-touch-icon-precomposed" type="image/png" href="https://leanp...
#> ...
res$content
#> {html_document}
#> <html class="no-js" lang="en">
#> [1] <head>\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8 ...
#> [2] <body id="sessions-login">\n\n<div class="flash" id="js-flash-prototype"> ...
Metadata

Version

0.4.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows