| Crates.io | xplore |
| lib.rs | xplore |
| version | 0.1.12 |
| created_at | 2025-02-25 14:18:32.259503+00 |
| updated_at | 2025-07-11 16:41:35.570439+00 |
| description | X/Twitter scraper for Rust |
| homepage | |
| repository | https://github.com/zTgx/xplore |
| max_upload_size | |
| id | 1569181 |
| size | 236,762 |
💥 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.
[dependencies]
xplore = "0.1"
Two method to authenticate with Cookie:
loginlet mut xplore = Xplore::new(None).await.unwrap();
xplore.login(username, password, email, two_factor_secret).await;
OR
set_cookielet mut xplore = Xplore::new(None).await.unwrap();
let cookie = env::var("X_COOKIE_STRING").expect("X_COOKIE_STRING");
xplore.set_cookie(&cookie).await;
[!IMPORTANT] How to Get Request Cookie for Authentication
Steps to Retrieve Cookie:
Open Chrome Developer Tools:
- Press
F12orFn+F12(depending on your keyboard)- Alternatively: Right-click → "Inspect" → "Network" tab
Locate the Request:
- Filter requests and select
user_flow.json- Navigate to the "Headers" section
Copy Cookie Value:
- Under "Request Headers" → Find the "Cookie" field
- Select and copy the entire cookie string
Configure Environment:
- Paste the copied value in your
.envfile:X_COOKIE_STRING=your_copied_cookie_value_hereNote: This cookie is used for authentication - keep it secure and never commit to version control.
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:#?}");
}
MIT