Skip to content

iFraan/mrivals

Repository files navigation

🦸‍♂️ mrivals

CodeFactor NPM-Version NPM-Downloads Github Stars Issues

📊 A wrapper/scraper for Marvel Rivals stats

Powered by TRNetwork - No API keys required!


🚀 Installation

Note: This module supports multiple fetching strategies for maximum compatibility across different environments.

💻 Install the package

npm install mrivals

📖 Usage

Important: You must call API.fetchUser before using any other method.

🔧 Fetching Strategies

This module can use multiple strategies to fetch data: fetch, curl, and flaresolverr

🌐 Browser Environments

  • Default fetch should work fine
  • Can use flaresolverr if available for enhanced reliability

🖥️ Server Environments

  • Try fetch first (Node.js v16+)
  • Switch to curl if fetch fails
  • flaresolverr is recommended (default Docker image works great)

⚙️ Configuration Options

Option Type Description Default
useCurl boolean Whether to use curl instead of fetch false
flaresolverrUrl string The URL of the flaresolverr instance undefined
await API.fetchUser(username, {
  flaresolverrUrl: 'https://some.flaresolverr.domain:8191', // Use flaresolverr instance
  useCurl: true, // Use curl instead of fetch (omitted when flaresolverrUrl is provided)
});

🆔 Username Format

Simply use your username: username (no need for #tag format)

🔧 Available Methods

Method Description
info() Returns user and MMR information
overview() Returns overview stats
heroes() Returns hero-specific stats
roles() Returns role-specific stats
peakRank() Returns peak rank information
raw() Returns raw response data

💡 Example Usage

Feel free to use my username for testing: ifraan

const { API } = require('mrivals');

async function getPlayerStats() {
    try {
        // Fetch user data
        const user = await API.fetchUser('ifraan');
        
        // Get basic user info
        console.log('👤 User Info:', user.info());
        /*
        Output: User and MMR information
        */
        
        // Get overview stats
        console.log('📊 Overview:', user.overview());
        /*
        Output: General gameplay statistics
        */
        
        // Get hero stats
        console.log('🦸‍♂️ Heroes:', user.heroes());
        /*
        Output: Hero-specific performance data
        */
        
        // Get role stats
        console.log('🎭 Roles:', user.roles());
        /*
        Output: Role-based statistics
        */
        
        // Get peak rank
        console.log('🏆 Peak Rank:', user.peakRank());
        /*
        Output: Highest achieved rank
        */
        
        // Get raw data
        console.log('📋 Raw Data:', user.raw());
        /*
        Output: Complete unprocessed response
        */
        
    } catch (error) {
        console.error('❌ Error:', error.message);
        // Example: "We could not find the player [player]."
    }
}

// Run the example
getPlayerStats();

📄 License & Disclaimer

This project is created for educational purposes only and is not affiliated with NetEase Games or Marvel Rivals.

If you want to use Marvel Rivals data in a production/commercial environment, please contact the team at TRNetwork.


Made with ❤️ by iFraan

Assemble your stats! 🚀

About

Wrapper for Marvel Rivals Stats

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published