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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gs-x-parser

v1.0.1

Published

GS X Parser 是一个用于解析 Twitter/X API 响应的 TypeScript 库,提供了完整的类型定义和解析功能,支持将复杂的 API 响应转换为简单易用的格式。

Readme

GS X Parser

GS X Parser 是一个用于解析 Twitter/X API 响应的 TypeScript 库,提供了完整的类型定义和解析功能,支持将复杂的 API 响应转换为简单易用的格式。

English

功能特性

  • 完整的 TypeScript 类型定义,基于 Twitter/X API 数据结构
  • 支持解析用户、推文、媒体等多种数据类型
  • 提供简单模式和原始模式两种解析方式
  • 支持从各种 API 响应中提取数据
  • 类型安全,确保数据处理的可靠性

安装

# 使用 npm
npm install gs-x-parser

# 使用 yarn
yarn add gs-x-parser

使用示例

解析简单模式

import { XParser } from './src/parser/XParser';

// 解析 API 响应
const data = {/* 从 API 获取的数据 */};
const result = XParser.parseSimple(data);

// 访问解析结果
console.log(result.users); // 简单用户列表
console.log(result.tweets); // 简单推文列表
console.log(result.photos); // 包含图片的推文
console.log(result.videos); // 包含视频的推文
console.log(result.urls); // 包含链接的推文

解析原始模式

import { XParser } from './src/parser/XParser';

// 解析 API 响应
const data = {/* 从 API 获取的数据 */};
const result = XParser.parseOriginal(data);

// 访问解析结果
console.log(result.users); // 原始用户列表
console.log(result.tweets); // 原始推文列表
console.log(result.photos); // 包含图片的推文
console.log(result.videos); // 包含视频的推文
console.log(result.urls); // 包含链接的推文

类型定义

项目在 src/type 目录下提供了完整的类型定义,包括:

  • IUser - 用户类型
  • ITweet - 推文类型
  • IMediaEntity - 媒体实体类型
  • ISimpleUser - 简单用户类型
  • ISimpleTweet - 简单推文类型
  • ISimpleResult - 简单结果类型
  • IOriginalResult - 原始结果类型

许可证

本项目使用 MIT 许可证,详情请查看 LICENSE 文件。