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

@anyalphatop/cdpx

v1.0.7

Published

Make any website programmable via Chrome CDP.

Downloads

855

Readme

cdpx

English | 中文

通过 Chrome CDP 让任何网站可编程。

安装

npm install -g @anyalphatop/cdpx

命令

ping

测试与 Chrome CDP 服务器的连接。

cdpx ping [options]

选项:

| 选项 | 说明 | 默认值 | |------|------|--------| | --host <host> | CDP 主机 | localhost | | --port <port> | CDP 端口 | 9222 | | --timeout <ms> | 连接超时时间(毫秒) | 5000 |

示例:

cdpx ping
cdpx ping --host 127.0.0.1 --port 9222

返回结果:

| 字段 | 类型 | 说明 | |------|------|------| | connected | boolean | 是否连接成功 | | browser | string | 浏览器名称及版本(如 Chrome/131.0.0.0) | | protocolVersion | string | CDP 协议版本(如 1.3) | | webSocketDebuggerUrl | string | 调试器 WebSocket 地址 | | error | string | 连接失败时的错误信息 |

tabs

列出已连接 Chrome 浏览器中所有打开的标签页。

cdpx tabs

返回结果:

返回一个标签页对象数组。

| 字段 | 类型 | 说明 | |------|------|------| | id | string | 标签页 ID | | title | string | 标签页标题 | | url | string | 标签页 URL | | type | string | 标签页类型(如 pagebackground_page) |

probe

测量指定 URL 到达 network idle 状态所需的时间。

cdpx probe <url>

参数:

| 参数 | 说明 | |------|------| | url | 要测量的目标 URL |

选项:

| 选项 | 说明 | 默认值 | |------|------|--------| | --idle-window <ms> | 判定 network idle 的静默窗口(毫秒) | CDPX_NETWORK_IDLE_WINDOW500 |

示例:

cdpx probe https://weibo.com
cdpx probe https://weibo.com --idle-window 1000

返回结果:

返回从导航开始到 network idle 所经过的毫秒数。

1823

domains

列出加载页面时访问的所有注册域名。

cdpx domains <url>

参数:

| 参数 | 说明 | |------|------| | url | 要加载的目标 URL |

选项:

| 选项 | 说明 | 默认值 | |------|------|--------| | --idle-window <ms> | 判定 network idle 的静默窗口(毫秒) | CDPX_NETWORK_IDLE_WINDOW500 |

示例:

cdpx domains https://weibo.com

返回结果:

返回去重后按字母排序的注册域名 JSON 数组。子域名会折叠到注册域名(如 static.example.comexample.com)。

["sinaimg.cn", "weibo.com", "weibocdn.com"]

read

使用 Readability 获取指定页面的文章内容。

cdpx read <url>

参数:

| 参数 | 说明 | |------|------| | url | 要读取的目标 URL |

选项:

| 选项 | 说明 | 默认值 | |------|------|--------| | --idle-window <ms> | 判定 network idle 的静默窗口(毫秒) | CDPX_NETWORK_IDLE_WINDOW500 | | --settle <ms> | network idle 之后的额外等待时间(毫秒) | 0 |

示例:

cdpx read https://example.com/article
cdpx read https://example.com/article --settle 500

返回结果:

返回一个 JSON 对象,包含以下字段:

| 字段 | 类型 | 说明 | |------|------|------| | title | string \| null | 文章标题 | | content | string \| null | 处理后的文章内容(HTML 格式) | | textContent | string \| null | 去除所有 HTML 标签后的纯文本内容 | | length | number \| null | 文章字符数 | | excerpt | string \| null | 文章描述或摘要 | | byline | string \| null | 作者信息 | | dir | string \| null | 内容方向 | | siteName | string \| null | 网站名称 | | lang | string \| null | 内容语言 | | publishedTime | string \| null | 发布时间 |

x

x.com 相关命令。

x read

读取一条推文及其评论(可选)。

cdpx x read <url>

参数:

| 参数 | 说明 | |------|------| | url | 推文 URL |

选项:

| 选项 | 说明 | 默认值 | |------|------|--------| | --comments | 获取评论 | false | | --limit <n> | 最多获取评论数量 | 20 |

示例:

cdpx x read https://x.com/user/status/123456789
cdpx x read https://x.com/user/status/123456789 --comments
cdpx x read https://x.com/user/status/123456789 --comments --limit 50

返回结果:

返回一个 JSON 对象,包含以下字段:

| 字段 | 类型 | 说明 | |------|------|------| | post | object | 主推文 | | post.type | 'post' \| 'article' | 推文类型 | | post.title | string \| null | 标题(仅 article 类型有值) | | post.text | string \| null | 推文文本 | | comments | object[] | 评论列表(仅在指定 --comments 时返回) | | comments[].text | string \| null | 评论文本 |

x posts

获取指定用户的推文列表。

cdpx x posts <id>

参数:

| 参数 | 说明 | |------|------| | id | 用户 ID(用户名) |

选项:

| 选项 | 说明 | 默认值 | |------|------|--------| | --since <timestamp> | 只返回该 Unix 时间戳(秒)之后的推文 | — | | --limit <n> | 最多获取推文数量 | 10 |

示例:

cdpx x posts elonmusk
cdpx x posts elonmusk --limit 20
cdpx x posts elonmusk --since 1700000000

返回结果:

返回一个推文对象数组:

| 字段 | 类型 | 说明 | |------|------|------| | id | string | 推文 ID | | time | number | Unix 时间戳(秒) | | text | string | 推文文本 |

weibo

微博相关命令。

weibo aisearch

使用微博 AI 搜索功能搜索内容,并以文本形式返回结果。

cdpx weibo aisearch <query>

参数:

| 参数 | 说明 | |------|------| | query | 搜索关键词 |

示例:

cdpx weibo aisearch "人工智能"

返回结果:

返回 AI 生成的搜索结果纯文本字符串。

weibo hot

获取当前微博热搜榜单。

cdpx weibo hot

返回结果:

返回一个热搜词条名称的字符串数组。

["话题A", "话题B", "话题C"]

weibo post

发布一条微博。--text--file--image 三者至少需要指定一项。

cdpx weibo post [options]

选项:

| 选项 | 说明 | |------|------| | -t, --text <text> | 微博文本内容 | | -f, --file <path> | 文本文件路径,文件内容将作为微博正文。与 --text 互斥 | | -i, --image <paths...> | 一张或多张图片的文件路径 | | -o, --topic <topics...> | 一个或多个话题,每个话题格式为 #话题#,追加在正文末尾另起一行 |

示例:

# 纯文字
cdpx weibo post -t "今天天气不错"

# 文字加话题
cdpx weibo post -t "今天天气不错" -o 生活 -o 日记

# 从文件读取正文并带图片
cdpx weibo post -f /path/to/content.txt -i /path/to/image.jpg

# 纯图片
cdpx weibo post -i /path/to/image.jpg

# 多张图片加话题
cdpx weibo post -i /path/to/a.jpg /path/to/b.jpg -o 摄影