| Crates.io | pullcaps |
| lib.rs | pullcaps |
| version | 0.2.0 |
| created_at | 2022-02-05 04:46:39.187984+00 |
| updated_at | 2022-02-06 02:53:10.019922+00 |
| description | An asynchronous client for the PushShift API |
| homepage | |
| repository | https://github.com/dcchut/pullcaps |
| max_upload_size | |
| id | 527269 |
| size | 67,301 |
A convenient, opinionated, asynchronous client for the PushShift API.
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.
Licensed under either of