Giter Site home page Giter Site logo

xbox-query's Introduction

xbox-query

一个用于查询 xbox 玩家信息的 工具/API,基于 node.js 。

CLI 使用方法

安装

该工具需要 node.js 运行环境,请确保在使用此工具前安装了 nodejs。

npm install -g xbox-query

登录 Xbox 账号

根据提示输入相应内容

xbox-query login

查询玩家信息

通过xuid或者gamertag来获取玩家信息。

xuid-query query <gamertag|xuid>

API

xbox-query 通常与 @xboxreplay/xboxlive-authauthenticate 连用。为方便起见,xbox-query 直接从依赖中导出 authenticate,因此你可以直接从xbox-query导入它。

以下为主页函数与类型别名的伪声明代码:

// authenticate 与 CredentialsAuthenticateResponse, 直接导入来自 @xboxreplay/xboxlive-auth
import { CredentialsAuthenticateResponse, authenticate } from "@xboxreplay/xboxlive-auth";

type GamerProfile = {
    xuid: string;
    GameDisplayName: string;
    Gamertag: string;
    GameDisplayPicRaw: string;
    Gamerscore: number;
    TenureLevel: number;
};

/**
 * 获取指定玩家信息
 *
 * @param {CredentialsAuthenticateResponse} auth_data 请求用到的 token
 * @param {string} tag 目标玩家的 gamertag 或者 xuid
 * @return {*}  {Promise<GamerProfile>} 玩家信息
 */
function query(auth_date: CredentialsAuthenticateResponse, tag: string): Promise<GamerProfile>;

以下为示例代码。此代码将会登录[email protected]的 Xbox 账号并使用它的 token ,然后获取 xuid123456789 玩家的信息。

import { authenticate, query } from "xbox-query";

authenticate("[email protected]", "password").then(data => {
    console.log(
        query(data, "123456789").then(result => {
            console.log(result);
        })
    );
});

xbox-query's People

Contributors

xiyang6666 avatar fbikdot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.