Documentation

xplore

X scraper for Rust

Version Crates Downloads GitHub License

💥 PRs are welcome.
❗We are still in the early development phase, so please be aware that the interfaces may evolve as we continue to refine the project.

Features

  • Authentication with cookies
  • Comprehensive user profile management
  • Timeline retrieval
  • Tweet interactions (like, retweet, post)
  • Advanced search capabilities
  • User relationship management (follow/unfollow)

Installation

[dependencies]
xplore = "0.1"

Usage

Two method to authenticate with Cookie:

  • By using login
let mut xplore = Xplore::new(None).await.unwrap();

xplore.login(username, password, email, two_factor_secret).await;

OR

  • By using set_cookie
let mut xplore = Xplore::new(None).await.unwrap();

let cookie = env::var("X_COOKIE_STRING").expect("X_COOKIE_STRING");
xplore.set_cookie(&cookie).await;

A quick start

use dotenv::dotenv;
use std::env;
use xplore::Xplore;

#[tokio::main]
async fn main() {
    dotenv().ok();

    let mut xplore = Xplore::new(None).await.unwrap();

    let cookie = env::var("X_COOKIE_STRING").expect("X_COOKIE_STRING");
    xplore.set_cookie(&cookie).await;

    let screen_name = "zTgx5"; // Replace with the desired screen name
    println!("Getting profile for: {screen_name}");
    let profile = xplore.get_profile(screen_name).await.expect("Failed to get profile");
    println!("Profile: {profile:#?}");
}

Star History

Star History Chart