Crate dot4ch[][src]

Expand description

dot4ch

dot4ch is a convenient wrapper library around 4chan’s API.

This library can fetch and update:

  • Posts
  • Threads
  • Catalog

While respecting 4chan’s:

  • GET 1 second-per-request cooldown.
  • If-Modified-Since headers with update requests.
  • 10 second cooldown with Thread, Catalog and Board update requests.

Example: Getting an image from the OP of a thread

#[tokio::main]
async fn main() {
    use dot4ch::{Client, thread::Thread};
    let mut client = Client::new();

    let board = "g";

    let post_id = 81743559_u32;

    let thread = Thread::new(&client, board, post_id).await.unwrap();
     
    let post = thread.op();
    println!("{}", post.image_url(board).unwrap());
}

Modules

board

A cache of the entire board.

post

Holds an information of a single post

thread

Contains information about a 4chan thread.

threadlist

A list of all avaliable threads in a Board

Structs

Client

The main client for accessing API. Handles updates, board and reqwest::Client

Traits

Update

Update trait specifies if something can be updated or not.