npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xbox-query

v1.4.0

Published

nodejs CLI tool for querying xbox player data

Downloads

17

Readme

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);
        })
    );
});