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

shellx-ai

v1.1.3

Published

A powerful TypeScript library for Android device automation and UI control via WebSocket

Readme

ShellX-AI 数据采集与监控系统

一个完整的数据采集、传输和可视化监控系统,使用 ShellX-AI SDK 进行设备数据采集,Node.js 后端接收和存储数据,Web 界面实时展示。

📋 功能特性

  • ✅ 使用 ShellX-AI SDK 自动采集设备屏幕数据
  • ✅ 实时提取数值数据(点赞数、评论数、分享数等)
  • ✅ 实时提取文本数据
  • ✅ Node.js 后端接收和存储数据
  • ✅ Web 界面实时展示和监控
  • ✅ 历史数据记录和趋势分析
  • ✅ 统计指标计算

🚀 快速开始

1. 安装依赖

npm install

2. 启动系统

方式一:分别启动

# 终端1:启动后端服务器
npm run server

# 终端2:启动数据采集
npm run collect

方式二:同时启动(推荐)

npm run dev

3. 访问监控面板

打开浏览器访问:http://localhost:3000

📁 项目结构

.
├── collect_douyin_data.ts    # 数据采集脚本(使用 ShellX-AI SDK)
├── server.ts                 # Node.js 后端服务器
├── package.json              # 项目配置和依赖
├── README.md                 # 项目说明文档
└── public/
    └── index.html           # 数据展示页面

🔧 配置说明

修改采集间隔

collect_douyin_data.ts 中修改:

// 每5秒采集一次
setInterval(async () => {
  try {
    await collectVideoData();
  } catch (error) {
    console.error('采集出错:', error.message);
  }
}, 5000); // 修改这个值(毫秒)

修改后端端口

server.ts 中修改:

const PORT = 3000; // 修改为你想要的端口

修改API地址

collect_douyin_data.ts 中修改:

const API_URL = 'http://localhost:3000/api/data';

📊 数据格式

发送到后端的数据格式

{
  timestamp: string;           // 时间戳
  app: string;                 // 当前应用
  screen: {                    // 屏幕信息
    width: number;
    height: number;
  };
  metrics: {
    numericData: Array<{       // 数值数据
      label: string;
      value: number;
      raw: string;
    }>;
    textData: Array<{          // 文本数据
      text: string;
      id: string;
    }>;
  };
  elementCount: number;        // 元素总数
}

🌐 API 接口

POST /api/data

接收采集的数据

请求体: 数据采集对象

响应: { success: true, message: 'Data received' }

GET /api/data

获取所有数据

响应: 完整的数据存储对象

GET /api/history?limit=50

获取历史数据

参数:

  • limit: 返回的记录数(默认50)

响应: 历史数据数组

GET /api/metrics

获取统计指标

响应: 统计指标对象

POST /api/clear

清空所有数据

响应: { success: true, message: 'Data cleared' }

📱 支持的应用

当前脚本针对抖音(com.ss.android.ugc.aweme)进行了优化,但可以轻松适配其他应用:

  1. 修改 collect_douyin_data.ts 中的数据提取逻辑
  2. 根据目标应用的 UI 结构调整过滤条件

🔍 数据采集原理

  1. 获取设备信息:使用 shellx.getScreenInfo() 获取屏幕状态
  2. 获取UI元素:使用 shellx.findElementsWithRetry() 获取屏幕所有元素
  3. 数据过滤
    • 数值数据:匹配数字格式(支持"1.2万"、"10w"等)
    • 文本数据:过滤出有意义的长文本
  4. 数据传输:通过 HTTP POST 发送到后端
  5. 数据展示:Web 界面实时更新和可视化

🛠️ 技术栈

  • 数据采集: ShellX-AI SDK
  • 后端: Node.js + Express + TypeScript
  • 前端: HTML + CSS + JavaScript
  • 数据传输: REST API + JSON

📝 注意事项

  1. 确保设备已连接并授权 ShellX-AI
  2. 后端服务器必须先启动才能接收数据
  3. 数据采集频率不宜过高,避免对设备性能产生影响
  4. 根据实际需求调整数据过滤和提取逻辑

🚨 故障排除

数据无法显示

  1. 检查后端服务器是否正常运行
  2. 检查采集脚本是否正常启动
  3. 检查浏览器控制台是否有错误信息
  4. 确认 API 地址配置正确

采集脚本报错

  1. 检查设备连接状态
  2. 确认 ShellX-AI SDK 已正确安装
  3. 查看错误日志定位问题

📄 许可证

MIT License

🤝 贡献

欢迎提交 Issue 和 Pull Request!