最近推送 2026-11-02 22:40(30 天前),属于活跃维护
cutetailbud/ff-ruyijs
GITHUB中文整理主语言 C++ · 651 星 · AGPL-3.0 · 创建于 2026-10-28
一个用 Python 调用真实 Firefox 引擎执行网页 JavaScript 的库,底层为无头 SpiderMonkey 与 Necko,面向自动化与抓取。
仓库健康度
5 个维度开放 Issue 12 个 · Fork 289 个
24 小时 +0 · 7 日 +0 · 30 日 +0
许可证 AGPL-3.0 · 8 个 topics · 开了 Wiki
这一项暂无数据,不代表项目没有发布
「证据不足」表示这项数据暂时没有取到,不能读成「项目有问题」;「部分数据」表示只拿到一部分信号。版本发布要额外调 Releases 接口,下一版补。
Star 趋势
31 天记录横轴 2026-11-03 → 2026-12-03,纵轴按这段时间的最小/最大值拉伸。趋势来自站内每天记录一次的星数,页面打开时不会实时请求 GitHub。
它解决什么问题
据 README 归纳不少网站的关键逻辑、令牌和设备校验都跑在页面 JavaScript 里,仅靠普通 HTTP 请求往往拿不到这些结果。没有这类工具,就得启动完整浏览器或手动重写脚本,成本和环境负担都高。它让 Python 程序直接获得接近 Firefox 的脚本执行环境。
核心能力
6 条- 1在 Python 中执行 JavaScript,同一上下文内变量与函数可跨多次调用保留
- 2提供较完整的 Web API 环境,可加载真实页面并运行站点自身脚本
- 3通过统一配置设定 Navigator、Screen、视口、时区与语言等环境参数
- 4内置可独立运行的示例,覆盖多种站点校验场景并提供直连与代理选项
- 5安装后无需下载浏览器,离线即可运行本地脚本
- 6提供 ruyiHttp 同类项目,封装 Firefox 原生网络组件
项目画像
6 个角度项目定位
一个用 Python 调用真实 Firefox 引擎执行网页 JavaScript 的库,底层为无头 SpiderMonkey 与 Necko,面向自动化与抓取。
适合谁
需要在 Python 中运行页面 JavaScript 做自动化、分析或抓取的研究者与开发者,适合处理依赖脚本生成令牌或进行设备校验的站点。
典型场景
在 Python 自动化脚本中加载目标页面,让站点自身 JavaScript 生成所需令牌;借助示例复现 Akamai Bot Manager、DataDome 等设备校验流程用于研究;配置语言、屏幕、时区等环境参数后执行页面脚本,观察不同环境下的行为;通过代理选项运行示例并把结果保存为 JSON,用于抓取与分析
部署难度
通过 pip 安装即可,Windows 安装包自带运行时,装完能直接离线运行本地脚本;macOS 与 Linux 的细节存在差异,需按对应平台文档准备环境,大致几步可跑通首个示例。
风险限制
需 64 位 Python 3.10 及以上,仅限 Windows x64、macOS 26 及以上 Apple Silicon、以及满足 glibc 2.39 的 Linux x86_64;没有页面布局与渲染,各平台存在差异。
最近维护
最近一次推送是 2026-11-02 22:40。 实现方式:库在无浏览器窗口的情况下嵌入 Firefox 的脚本引擎,并用其网络组件加载页面,使站点脚本在模拟的浏览器环境中执行;Python 侧通过上下文对象调用脚本并读写环境配置,页面脚本在配置生效后运行。
README 原文细节
5 个板块怎么安装从零跑起来的步骤
📦 Installation
Requirements: 64-bit Python 3.10+ on Windows x64, on macOS 26 or later (Apple Silicon), or on Linux x8664 with glibc 2.39 or later (Ubuntu 24.04, Debian 13, Fedora 40 and newer).
The Windows wheel ships the SHA256-pinned SpiderMonkey + Necko runtime (~42 MB). Local scripts run offline right after install — no browser download, no external dependencies.
macOS arm64: the macosx260arm64 wheel loads pages over direct HTTPS through libneckocore.dylib and libneckoquic.dylib, linked against the NSS of the same Firefox source. It has no xpcshell. Context(proxy=...) uses an HTTP CONNECT tunnel into libneckocore when that binary is absent. The Necko helper runs on the Python that installed ruyijs; its packages are dependencies of the macOS wheel. Details and the remaining gaps are in docs/macos.md.
Linux x8664: the manylinux239x8664 wheel is a native ELF build, contributed by @Starktomy in #5. Text uses fontconfig, FreeType and HarfBuzz with the fonts installed on the machine, WebCrypto uses OpenSSL 3, and the Necko helper (NSS 3.131, Neqo for HTTP/3) brings its own Python. See docs/linux.md.
python -m pip install ruyijs
🚀 Quick start
1 · Open a context and run JavaScript. Variables and functions persist across eval calls within the same context.
3 · Point it at a real target. Configure the environment, load the page, and let the site's own JavaScript mint whatever token it demands.
from ruyijs import Context
with Context() as context:
context.eval("let count = 40")
print(context.eval("count += 2")) # 42
print(context.eval("navigator.userAgent"))
怎么用最典型的用法与示例
🧪 Examples
Examples ship inside the package — no need to clone the repo:
Every example supports --direct (direct connection) and --proxy http://127.0.0.1:7890. Add --help after a name for all options, and --output result.json to save results. Each example directory ships its own README.
python -m ruyijs.examples # list every example and its install path
python -m ruyijs.examples akamai # Akamai Bot Manager 3.x
python -m ruyijs.examples datadome # DataDome interstitial device-check
python -m ruyijs.examples creepjs # CreepJS fingerprint audit
python -m ruyijs.examples --shared akamai datadome creepjs # several at once, one shared engine
配置项能调整哪些参数
Configure the browser environment
Set Navigator, Screen, viewport, timezone, and locale through one validated profile surface. Commit it before the first page script runs.
with Context() as context:
context.configure_fingerprint({
"navigator": {"language": "zh-CN", "hardwareConcurrency": 8},
"screen": {"width": 1920, "height": 1080},
"viewport": {"width": 1280, "height": 720},
"locale": {"timezone": "Asia/Shanghai"},
})
print(context.eval("[navigator.language, screen.width]")) # ['zh-CN', 1920]
限制与常见问题项目自己写明的坑与限制
📏 Scope & limitations
ruyiJS provides JavaScript execution and a broad Web API environment on Windows x64, macOS arm64 and Linux x8664. It has no browser window and no full page layout or rendering — it is a tool for automation, analysis, and research. Use it in compliance with the terms of service of any site you interact with and with applicable law. The platform differences are in docs/macos.md and docs/linux.md.
Related: ruyiHttp — a Requests-style Python HTTP library built on Firefox's native networking components.
❓ FAQ / Troubleshooting
64-bit Python 3.10 and above on every platform, tested up to Python 3.14. On macOS the Necko helper runs on the interpreter that installed ruyijs; the Linux wheel brings its own Python 3.14 for it.
Yes. PyPI has a macosx260arm64 wheel (macOS 26 or later) and a manylinux239x8664 wheel (glibc 2.39 or later). The macOS wheel has no xpcshell; since 0.3.1 Context(proxy=...) uses an HTTP CONNECT tunnel there. See docs/macos.md and docs/linux.md.
The JS engine is Mozilla's official SpiderMonkey and the networking stack is Mozilla's official Necko — both are built from the official Firefox source, referenced as the firefox/ submodule.
No. Every wheel bundles the SpiderMonkey + Necko runtime built from the Firefox 159.0 source, and pip install ruyijs needs no browser. On macOS, pip also installs the Python packages of the Necko helper.
- Make sure you use the with statement (with Context() as ctx:) so the process is cleaned up properly.
- Increase the timeout: Context(timeout=60).
- On Wine, upgrade to ≥ 0.1.5 which fixes a known navigate deadlock.
其它说明README 里剩下的内容
Is ruyiJS for you?
Headless Chrome and Playwright hand you a whole browser: a GPU-rendering, window-managing, memory-hungry process that anti-bot vendors have spent years learning to detect. ruyiJS takes the opposite path — it embeds only the Firefox internals that matter for automation and leaves the rest behind:
If you scrape, reverse-engineer web JavaScript, or collect data behind a challenge, it's for you. If a plain HTTP client already gets your pages, you don't need it.
Wheels for Windows x64, macOS arm64 and Linux x8664 are on PyPI for Python 3.10+. GitHub Actions builds each of them from the official Firefox 159.0 source (build from source).
- The real engine, not an impersonation. Genuine SpiderMonkey (Firefox 159) and the Necko network stack execute a site's JavaScript, challenges, signatures, and fingerprints exactly as Firefox would.
- Truly headless. No window, no layout, no renderer. A pure JavaScript + Web API environment that starts fast and stays light.
- Isolated and reproducible. Each Context is its own process with a persistent JavaScript world and its own proxy, so sessions never leak into each other.
- Offline when you need it. Serve scripts and responses yourself and replay a whole captured flow with no network.
Run any site's JavaScript from Python — with the real Firefox engine.
A new-generation, minimalist browser purpose-built for AI-driven automation. The authentic Firefox JavaScript engine and networking stack, with no window and no renderer — made for web scraping, JS reverse engineering, data collection, and getting past bot checks.
Build from source
The firefox/ submodule is the official Firefox 159.0 release (mozilla-firefox/firefox at FIREFOX1590RELEASE, a shallow clone). The workflows that build the PyPI wheels are the reference for a local build: .github/workflows/wheels.yml runs ci/firefox/build.sh js|browser|toolchain and tools/build.py on Windows and macOS, and the steps of ci/linux/build.sh on Linux.
关于 ff-ruyijs 的常见问题
7 个问题ff-ruyijs 是做什么的?
一个用 Python 调用真实 Firefox 引擎执行网页 JavaScript 的库,底层为无头 SpiderMonkey 与 Necko,面向自动化与抓取。 不少网站的关键逻辑、令牌和设备校验都跑在页面 JavaScript 里,仅靠普通 HTTP 请求往往拿不到这些结果。没有这类工具,就得启动完整浏览器或手动重写脚本,成本和环境负担都高。它让 Python 程序直接获得接近 Firefox 的脚本执行环境。
ff-ruyijs 有哪些功能?
核心能力:在 Python 中执行 JavaScript,同一上下文内变量与函数可跨多次调用保留;提供较完整的 Web API 环境,可加载真实页面并运行站点自身脚本;通过统一配置设定 Navigator、Screen、视口、时区与语言等环境参数;内置可独立运行的示例,覆盖多种站点校验场景并提供直连与代理选项;安装后无需下载浏览器,离线即可运行本地脚本;提供 ruyiHttp 同类项目,封装 Firefox 原生网络组件。
ff-ruyijs 适合谁用?
需要在 Python 中运行页面 JavaScript 做自动化、分析或抓取的研究者与开发者,适合处理依赖脚本生成令牌或进行设备校验的站点。
ff-ruyijs 是怎么工作的?
库在无浏览器窗口的情况下嵌入 Firefox 的脚本引擎,并用其网络组件加载页面,使站点脚本在模拟的浏览器环境中执行;Python 侧通过上下文对象调用脚本并读写环境配置,页面脚本在配置生效后运行。
怎么安装 ff-ruyijs?
按项目 README 的说明:Requirements: 64-bit Python 3.10+ on Windows x64, on macOS 26 or later (Apple Silicon), or on Linux x8664 with glibc 2.39 or later (Ubuntu 2;The Windows wheel ships the SHA256-pinned SpiderMonkey + Necko runtime (~42 MB). Local scripts run offline right after install — no browser ;1 · Open a context and run JavaScript. Variables and functions persist across eval calls within the same context.;3 · Point it at a real target. Configure the environment, load the page, and let the site's own JavaScript mint whatever token it demands.。完整命令见下方「怎么安装」一节或 GitHub 仓库的 README。
用 ff-ruyijs 有什么门槛或限制?
需 64 位 Python 3.10 及以上,仅限 Windows x64、macOS 26 及以上 Apple Silicon、以及满足 glibc 2.39 的 Linux x86_64;没有页面布局与渲染,各平台存在差异。
ff-ruyijs 现在还在维护吗?数据怎么样?
目前 651 星,289 个 Fork,主语言 C++,创建于 2026-10-28,最近一次推送 2026-11-02 22:40,许可证 AGPL-3.0。星数、Fork、推送时间都是 GitHub 返回的实时数据,「最近推送」离现在越近说明越活跃;长期不动要留意是否已停止维护。
这些内容来自哪
读法说明项目数据取自 GitHub 官方接口与项目 README;星数、Fork、语言与时间以 GitHub 页面为准,档案更新于 2026-11-03 21:01。