Skip to content

Examples

losenine edited this page Oct 31, 2026 · 1 revision

English · 中文

Examples

Three examples ship inside the package, so you do not need to clone the repository. Each one drives the site's own JavaScript to produce the parameters it demands and then completes the flow end to end. None of them injects or replaces browser APIs.

Strictly prohibited for any unlawful use. The examples are provided solely for research into a new generation of AI browsers. Live results depend on current network conditions and each site's present responses.

Name System Category Default target
akamai Akamai Bot Manager 3.x sensor_data + sbsd challenge https://www.radissonhotels.com/zh-cn/ (change with --url)
datadome DataDome interstitial device-check (plv2 + plv3) https://www.mouser.cn/
creepjs CreepJS fingerprint audit, every section https://abrahamjuliot.github.io/creepjs/

Running from the installed package

python -m ruyijs.examples                      # list the bundled examples
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 akamai --help        # all options of one example

Everything after the example name is passed on to the example script. python -m ruyijs.examples with no name (or -h, --help, list) prints the list. The exit code is the script's own — 0 when the flow passed, 1 otherwise; an unknown name exits with 2.

Running from a source checkout

python .\examples\akamai\akamai.py
python .\examples\DataDome\datadome.py
python .\examples\creepjs\creepjs.py

When the checkout has a local runtime (dist/js.exe, or dist/js on macOS), the scripts import the package from python/; otherwise they use the installed ruyijs. The DataDome and CreepJS scripts also switch to the source package when RUYIJS_SHELL is set.

Common flags

Flag Meaning
--proxy URL Use this HTTP(S) proxy, e.g. --proxy http://127.0.0.1:7890.
--direct Connect directly; cannot be combined with --proxy.
--output PATH Save the JSON result to a file, e.g. --output result.json.
--help Show every option.

Without --proxy or --direct, each example picks a proxy itself: the HTTPS_PROXY / https_proxy / HTTP_PROXY / http_proxy environment variables, then http://127.0.0.1:7890 if something listens there, otherwise a direct connection.

akamai — Akamai Bot Manager 3.x

Gets past the two Akamai gates — sensor_data (_abck cookie) and the sec-if-cpt sbsd challenge (bm_sc cookie) — and reaches the real page.

  • Flow: select the system clock and a full Firefox-on-Windows profile whose user agent matches --tls; navigate() to the target; let the challenge page load the sensor_data and sbsd scripts, which collect the environment and POST on their own; if _abck still needs it, dispatch trusted mouse events with dispatch_input(); wait for the page's own reload to the real page.
  • Options: --url (default https://www.radissonhotels.com/zh-cn/), --timeout overall seconds (default 180), --output / -o, --tls Firefox version 100–159 for both the TLS ClientHello and the User-Agent (default 159), --proxy / --direct. --test-api is accepted but not used by the current script.
  • Result: exit code 0 when the real page is reached. The JSON report includes a network summary, the cookie jar (export_cookies()) and recent console records.
  • Background, request sequence and recorded runs: examples/akamai/README.md.
python -m ruyijs.examples akamai --direct --output result.json
python -m ruyijs.examples akamai --tls 120

datadome — DataDome interstitial device-check

Runs DataDome's interstitial flow from the blocked homepage to a 200 response.

  • Flow: navigate() to the homepage, which answers 403 and opens the interstitial iframe; DataDome's own JavaScript collects the environment, computes payload (plv2) and plv3 and POSTs them; the returned datadome cookie lands in the Necko cookie jar; the script then fetches the homepage with that cookie.
  • Setup: Context(timeout=90, proxy=..., environment=...) with screen, viewport and timezone; the POST is read back from net_log().
  • Options: --proxy / --direct, --output (default: datadome_result.json next to the script).
  • Result: exit code 0 when the homepage returns 200. The homepage verdict is DataDome's server-side score (see docs/macos.md), so a run can end as submitted but not passed (PARTIAL).
  • Flow diagram and sample output: examples/DataDome/README.md.

creepjs — CreepJS fingerprint audit

Runs the full CreepJS page and reports its verdict.

  • Flow: system clock, navigate(), then advance() until both the loose and the stable fingerprint are reported. Pass/fail per section comes from the page's own console.log output and the FP ID from the rendered page; nothing is injected.
  • Options: --proxy / --direct, --timeout overall deadline in seconds (default 60), --output (the JSON is printed either way).
  • Output fields: fpId, fuzzy, passed (section → milliseconds), failed, notRun, consoleErrors, scriptErrors, ok, elapsedSeconds.
  • Result: exit code 0 when fingerprinting completed, the loose and stable fingerprints both passed and no section failed.
  • Details and the capabilities added for this example: examples/creepjs/README.md.

Patterns worth copying

  • Call configure_clock("system") before navigate() on live sites.
  • Loop advance(ms, max_tasks=...) and check the page state with eval() after each step.
  • Wrap advance() in try/except JSError to record page script errors and keep going.
  • Build the report from net_log(), console_log() and export_cookies().
  • Keep tls= and the navigator.userAgent version together.

The index of examples in the repository is examples/README.md.

Clone this wiki locally