Skip to content

一个使用Rust实现的跨平台的桌面端应用,用于查看 x.com 上的推文,支持下载推文中的图片和视频。

Notifications You must be signed in to change notification settings

Edsuns/x-player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

X Player

A cross-platform desktop application for downloading media from X.com tweets, built with Rust and Tauri.

Features

  • 📥 Download images and videos from X.com tweets
  • 🌐 Support for network proxies
  • 💻 Cross-platform support (Windows, macOS, Linux)
  • 🖥️ Intuitive GUI interface
  • 📋 Command-line interface for automation
  • 🔒 Secure authentication with X.com API
  • ⏱️ Real-time download progress tracking
  • 📁 Automatic file organization

Installation

Prerequisites

  • Rust (version 1.75 or higher)
  • FFmpeg (for downloading video streams)

Build from Source

  1. Clone the repository:

    git clone <repository-url>
    cd x-player
  2. Build the application:

    cargo tauri build
  3. The built application will be located in:

    • macOS: target/release/bundle/macos/X Player.app
    • Windows: target/release/bundle/msi/X Player.msi
    • Linux: target/release/bundle/appimage/X Player.AppImage

Usage

GUI Mode

  1. Launch the application
  2. Enter your X.com authentication tokens (auth_token and bearer_token)
  3. Configure proxy settings if needed
  4. Enter a tweet URL or ID
  5. Click "Fetch Media" to retrieve media from the tweet
  6. Click "Download" to save media to your specified directory

CLI Mode

Use the -c or --cli flag to run in command-line mode.

Command-line Options

Usage:
  x-player [OPTIONS]

Options:
  -i, --input <INPUT>              Tweet URL or ID (CLI mode only)
  -a, --auth-token <AUTH_TOKEN>    Authentication token [env: X_AUTH_TOKEN]
  -p, --proxy <PROXY>              Proxy URL (e.g. http://127.0.0.1:7897) [env: X_PROXY]
  -o, --output <OUTPUT>            Output directory [default: .]
  -c, --cli                        Run in CLI mode (disable GUI)
  -h, --help                       Print help
  -V, --version                    Print version

Examples

Download media from a tweet URL:

x-player -c -i "https://x.com/user/status/1234567890123456789" -a "your-auth-token" -o ./downloads

Using environment variables for authentication:

export X_AUTH_TOKEN="your-auth-token"
x-player -c -i "1234567890123456789" -o ./downloads

Using a proxy:

x-player -c -i "1234567890123456789" -a "your-auth-token" -p "http://127.0.0.1:7897" -o ./downloads

Authentication

To use this application, you need to obtain the auth_token from X.com:

  1. Log in to X.com in your browser
  2. Open Developer Tools (F12)
  3. Go to the Network tab
  4. Refresh the page
  5. Find a request to x.com and extract auth_token from cookies

The auth_token is required to access the X.com API. The application uses a fixed Bearer token internally.

Configuration

The application stores its configuration in a platform-specific location:

  • macOS: ~/Library/Preferences/com.example.x-player.plist
  • Windows: C:\Users\<username>\AppData\Roaming\x-player\config.json
  • Linux: ~/.config/x-player/config.json

Architecture

The application is structured into several modules:

  • src/main.rs: Entry point with CLI argument parsing
  • src/lib.rs: Tauri application setup and command handlers
  • src/x.rs: X.com API client and media extraction logic
  • src/media.rs: Media types and download functionality
  • src/config.rs: Configuration management
  • src/download_manager.rs: Download task management
  • src/utils.rs: Utility functions
  • dist/index.html: GUI interface

Troubleshooting

Common Issues

  1. Authentication failed: Ensure your auth_token and bearer_token are valid and not expired.
  2. Network errors: Check your internet connection and proxy settings.
  3. Download failures: Verify FFmpeg is installed and accessible in your PATH.
  4. API errors: X.com API changes may require application updates.

Logs

Application logs are available in the following locations:

  • macOS: ~/Library/Logs/x-player.log
  • Windows: C:\Users\<username>\AppData\Roaming\x-player\logs\x-player.log
  • Linux: ~/.config/x-player/logs/x-player.log

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Setup

  1. Install dependencies:

    cargo install tauri-cli
  2. Run the application in development mode:

    cargo tauri dev
  3. Run tests:

    cargo test

License

MIT License

Disclaimer

This application is not affiliated with, endorsed by, or connected to X.com. Use it at your own risk. Respect the terms of service of X.com when using this application.

About

一个使用Rust实现的跨平台的桌面端应用,用于查看 x.com 上的推文,支持下载推文中的图片和视频。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published