pullcaps

Crates.iopullcaps
lib.rspullcaps
version0.2.0
sourcesrc
created_at2022-02-05 04:46:39.187984
updated_at2022-02-06 02:53:10.019922
descriptionAn asynchronous client for the PushShift API
homepage
repositoryhttps://github.com/dcchut/pullcaps
max_upload_size
id527269
size67,301
Robert Usher (dcchut)

documentation

README

pullcaps

crates.io Documentation MIT/Apache-2 licensed CI

A convenient, opinionated, asynchronous client for the PushShift API.

Example

This library is built on top of Tokio, and currently produces streams from the futures crate. An example Cargo.toml could be:

[dependencies]
futures = { version = "0.3" }
pullcaps = { version = "0.1" }
tokio = { version = "1", features = ["full"] }

A small example is then:

use pullcaps::{Client, Filter};
use futures::StreamExt;

#[tokio::main]
async fn main() {
  let client = Client::new();
    
  // Get the five most recent posts in /r/askreddit
  let mut posts = client.get_posts(Filter::new().subreddit("askreddit")).await.take(5);
  while let Some(post) = posts.next().await {
    println!("url: {}", post.content_url);
  }
}

For additional examples see the documentation.

License

Licensed under either of

Commit count: 6

cargo fmt