#scraping #api #instagram

rocketapi

Unofficial RocketAPI Rust SDK for Instagram & Threads Private API 2024

2 releases

0.1.1 Jan 10, 2025
0.1.0 Sep 12, 2024

#211 in HTTP client

Download history 6/week @ 2025-01-16 1/week @ 2025-01-30 3/week @ 2025-02-06 26/week @ 2025-02-13 2/week @ 2025-02-20 3/week @ 2025-02-27

183 downloads per month

MIT license

37KB
385 lines

Introduction

This library provides a pure Rust interface for the RocketAPI.

Installing

To install rocketapi add in Cargo.toml

rocketapi = "0.1.1"

Examples

InstagramAPI example

use rocketapi::instagramapi::InstagramAPI;
use rocketapi::errors::RocketAPIError;

#[tokio::main]
async fn main() {
    let mut instagram_api: InstagramAPI = InstagramAPI::new(
        "Your API key",
        std::time::Duration::from_secs(30)
    );
    let username:&str = "kanyewest";
    match instagram_api.get_user_info(username).await {
        Ok(result) => {
            println!("Response: {:?}", result)
        }
        Err(RocketAPIError::BadResponse(msg)) => println!("{}", msg),
        Err(RocketAPIError::NotFound(msg)) => println!("{}", msg),
        Err(RocketAPIError::RequestError(msg)) => println!("{}", msg),
    }
}

ThreadsAPI example

use rocketapi::threadsapi::ThreadsAPI;
use rocketapi::errors::RocketAPIError;

#[tokio::main]
async fn main() {
    let mut threads_api: ThreadsAPI = ThreadsAPI::new(
        "Your API key",
        std::time::Duration::from_secs(30)
    );
    let user_id: u64 = 65107478842;
    match threads_api.get_user_feed(&user_id, None).await {
        Ok(result) => {
            println!("Response: {:?}", result)
        }
        Err(RocketAPIError::BadResponse(msg)) => println!("{}", msg),
        Err(RocketAPIError::NotFound(msg)) => println!("{}", msg),
        Err(RocketAPIError::RequestError(msg)) => println!("{}", msg),
    }
}

Usage

See the documentation for more information.

Dependencies

~5–16MB
~202K SLoC