substackr

Client library for the Substack API.

https://github.com/posocap/substackr

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Client library for the Substack API.

Basic Info
  • Host: GitHub
  • Owner: posocap
  • License: other
  • Language: HTML
  • Default Branch: main
  • Size: 1.44 MB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License

README.Rmd

# substackR

[![R-CMD-check](https://github.com/posocap/substackR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/posocap/substackR/actions/workflows/R-CMD-check.yaml)

A lightweight R client for the Substack API. All functions return data frames, handle errors with informative messages, and work out of the box once you’ve set your API key.

## Installation

From CRAN:

```r
install.packages("substackR")
```

Development version from GitHub:

```r
# install.packages("pak")   # if needed
pak::pak("posocap/substackR")
```

## Authentication

Provide your API key once per session with:

```r
library(substackR)
set_substack_key("your-substack-api-key")
```

If you haven’t set the key, any API call will prompt you to call `set_substack_key()` first.

## Main Functions

### get_substack_latest()

Fetches the latest posts.

```r
latest_posts <- get_substack_latest(
  publication_url = "posocap.substack.com",
  limit           = 10,
  offset          = 0
)
```

Returns a data frame with columns:

- slug
- url
- title
- description
- excerpt
- body_html
- reading_time_minutes
- audio_url
- date
- likes
- paywall
- cover_image
- cover_image_color_palette
- author
- author_image

### get_substack_top()

Fetches the top (most liked) posts.

```r
top_posts <- get_substack_top("posocap.substack.com", limit = 5)
```

### get_substack_search()

Searches posts by keyword.

```r
search_results <- get_substack_search(
  publication_url = "posocap.substack.com",
  query           = "data science",
  limit           = 20
)
```

### get_substack_post()

Retrieves a single post by slug.

```r
single_post <- get_substack_post(
  publication_url = "posocap.substack.com",
  slug            = "your-post-slug"
)
```

## Error Handling

- Missing API key → error asking you to run `set_substack_key()`.
- HTTP errors (4xx, 5xx, rate limits) → `cli::cli_abort()` with status code and message.
- JSON parsing issues → warning + empty data frame.

## Contributing

1. Fork the repo
2. Create a branch (e.g. `feature/xyz`)
3. Install dependencies:
   ```r
   devtools::install_deps(dependencies = TRUE)
   ```
4. Run tests:
   ```r
   devtools::test()
   ```
5. Submit a pull request.

## License

MIT © Posocap.com  
See `LICENSE` for details.

Owner

  • Name: Post-socialist Code
  • Login: posocap
  • Kind: user
  • Company: Poso Cap

https://posocap.com

GitHub Events

Total
  • Push event: 15
  • Create event: 4
Last Year
  • Push event: 15
  • Create event: 4

Packages

  • Total packages: 1
  • Total downloads:
    • cran 155 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: substackR

Access Substack Data via API

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 155 Last month
Rankings
Dependent packages count: 26.2%
Dependent repos count: 32.3%
Average: 48.3%
Downloads: 86.5%
Maintainers (1)
Last synced: 10 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.5.0 composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran