#api-client #async #mediafire

md_api

An async Rust client implementation of the MediaFire API

4 releases

Uses new Rust 2024

new 0.1.3 Mar 2, 2026
0.1.2 Feb 23, 2026
0.1.1 Feb 22, 2026
0.1.0 Feb 22, 2026

#1097 in Asynchronous


Used in md_downloader

MIT license

28KB
558 lines

md_api

md_api is an asynchronous Rust client for the MediaFire API, allowing you to:

  • Fetch file metadata
  • Fetch folder metadata
  • Fetch paginated folder contents
  • Extract file and folder keys from MediaFire URLs
  • Handle rate-limited requests with automatic retries

Built with tokio, reqwest, serde, and regex.

Features

  • Async API requests using Tokio runtime
  • Automatic retry with exponential backoff for rate-limited endpoints
  • Support for proxies
  • Extract keys from MediaFire URLs (files and folders)
  • Fetch both files and subfolders in a single request

Installation

Add this to your Cargo.toml:

md_api = "0.1"

Usage Example

use md_api::Api;
use tokio;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize API client with max 5 retries
    let api = Api::new(5)?;

    // Extract keys from URLs
    let urls = vec!["https://www.mediafire.com/file/j2tq12gr15jhq2r".to_string()];
    let keys = api.extract_keys_from_url(&urls)?;

    // Fetch file info
    for key in keys.iter() {
        let info = api.get_info(&key).await?;
        println!("{:#?}", info);
    }

    Ok(())
}

API Highlights

  • Api::new(max_retries: u64) – Create a new client.
  • Api::with_proxies(proxies: Vec<String>) – Configure HTTP proxies.
  • Api::get_info(&Key) – Fetch file or folder metadata.
  • Api::get_folder_content(&Key, ContentType, chunk) – Fetch folder content paginated.
  • Api::get_folder_and_file_content(&Key, chunk) – Fetch both files and folders in a single call.
  • Api::extract_keys_from_url(&Vec<String>) – Extract MediaFire keys from URLs.

Requirements

  • Rust 1.75+
  • Tokio runtime

License

Licensed under MIT

Dependencies

~8–25MB
~288K SLoC