1 unstable release
Uses new Rust 2024
| 0.1.0 | Dec 21, 2025 |
|---|
#1050 in HTTP server
37KB
919 lines
X/Twitter GraphQL API client.
Example
use x_rs::{X, CookieData};
#[tokio::main]
async fn main() -> x_rs::Result<()> {
let cookies = CookieData::new("ct0_value", "auth_token_value");
let client = X::builder().cookies(cookies).build().await?;
// Fetch user with pinned tweet
let user = client.user("Hi_Ohaasa").await?;
println!("{} has {} followers", user.username, user.follower_count);
// Fetch pinned tweet thread (e.g., daily horoscopes)
if let Some(pinned_id) = &user.pinned_tweet_id {
let detail = client.tweet_detail(pinned_id).await?;
println!("Main: {}", detail.tweet.text);
println!("Thread has {} replies", detail.thread.len());
}
Ok(())
}
Dependencies
~7–24MB
~295K SLoC