# Japanese Web Screenshot (`driedsandwich/japanese-web-screenshot`) Actor

- **URL**: https://apify.com/driedsandwich/japanese-web-screenshot.md
- **Developed by:** [driedsandwich](https://apify.com/driedsandwich) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 screenshots

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Japanese Web Screenshot

[日本語 README](README.ja.md) · [Pricing notes](.actor/PRICING.md)

An Apify SDK + Playwright Chromium Actor for screenshots of **public Japanese web pages**. It installs Noto Sans CJK JP, scrolls gradually to trigger lazy images, waits for fonts and images, and neutralizes fixed/sticky overlays. Each URL gets an isolated browser context and a Dataset result. One page failure does not stop later pages.

These are design features, not a measured superiority claim over `apify/screenshot-url`. The user supplied its monthly users (1,892), update date (2026-01-29), rating (3.9), and a competitor price of $0.00089/image. Those figures were not independently verified. No comparative benchmark was run.

### Run locally without an Apify account

Requires Node.js **22.13 or newer**, Linux browser libraries, and Noto Sans CJK JP. The included Dockerfile installs browser libraries and `fonts-noto-cjk`. Nothing requires login, registration, publication, or a push.

```sh
npm ci
npx playwright install chromium
## Debian/Ubuntu, if fonts or browser libraries are missing:
## sudo apt-get install fonts-noto-cjk fontconfig
## npx playwright install-deps chromium
fc-match ':lang=ja'
mkdir -p storage/key_value_stores/default
cp examples/public-pages.json storage/key_value_stores/default/INPUT.json
npm start
```

Use a clean local environment: do not set `APIFY_TOKEN`, `APIFY_IS_AT_HOME`, cloud storage IDs, or API endpoints. The evidence runner explicitly removes inherited `APIFY_*`, `ACTOR_*`, and `CRAWLEE_*` variables before invoking the Actor locally.

Optional Docker run (not executed in this environment; Docker is unavailable):

```sh
docker build -t japanese-web-screenshot .
docker run --rm --init --shm-size=1g \
  -v "$PWD/storage:/usr/src/app/storage" japanese-web-screenshot
```

The bind mount must be writable by the container's `node` user (UID 1000). Allow roughly 2 GB RAM. `npm ci` uses the included lockfile. The Docker base tag and apt repositories are not pinned to immutable digests, so OS package versions can change. Patched transitive `basic-ftp` and `minimatch` versions are pinned through `overrides`; the packaged tests exercise the resulting dependency tree.

### Input

`input_schema.json` is the Actor UI schema and the source for runtime defaults and bounds. Invalid overall input stops the run before navigation. Invalid individual URL strings become failed result rows.

| Field | Default | Meaning / limits |
|---|---:|---|
| `urls` | required | 1–50 HTTP(S) public URL strings; duplicates produce separate results |
| `width` | 1280 | 320–2560 CSS pixels; choose **390** for a mobile-width layout |
| `height` | 900 | 320–2160 CSS pixels; useful with viewport capture |
| `fullPage` | true | Whole document, or the top viewport after scrolling back |
| `waitUntil` | `load` | `load`, `domcontentloaded`, or `networkidle` |
| `extraWaitSeconds` | 2 | Additional 0–30 seconds after navigation |
| `waitForSelector` | empty | Optional CSS selector that must become visible before scrolling |
| `format` | `png` | `png` or `jpeg` |
| `jpegQuality` | 85 | 1–100, used only for JPEG |
| `fixedElements` | `hide` | Hide fixed elements and restore sticky elements to normal flow; `keep` preserves them |
| `navigationTimeoutSeconds` | 45 | 5–120 seconds for navigation / selector waits |
| `pageTimeoutSeconds` | 120 | 15–240 seconds total capture deadline per URL |
| `maxPageHeight` | 30000 | 1000–60000 CSS pixels; whole-page capture fails if exceeded |

Width 390 is a narrow viewport, **not** a mobile user agent, touch, or device emulation. Pixel ratio is 1; no device-scale ambiguity. Full-page image width can exceed the requested viewport width if the website overflows horizontally. Dataset `width`/`height` always come from the actual image bytes.

Example:

```json
{
  "urls": ["https://www.jma.go.jp/jma/index.html"],
  "width": 390,
  "height": 844,
  "fullPage": false,
  "waitUntil": "load",
  "extraWaitSeconds": 2,
  "waitForSelector": "body",
  "format": "jpeg",
  "jpegQuality": 85
}
```

### Capture behavior and limits

1. Open a fresh, unauthenticated context (`ja-JP`, Asia/Tokyo). Check HTTP status, HTML content type, and visible login/challenge indicators.
2. Apply requested waits. Disable smooth scrolling, transitions, and animations.
3. Scroll by 70% of a viewport, with pauses. Require a stable bottom; stop with a failure after 180 steps or 45 seconds. This also runs for viewport-only images to trigger lazy assets.
4. Return to the top. With `hide`, hide fixed elements and remove sticky positioning. This avoids repeated/overlapping bands but can omit navigation, banners, and other fixed content. `keep` is available when fidelity is more important.
5. Wait up to 10 seconds for fonts and 8 seconds for image completion; decode loaded images. A Chromium CDP probe verifies that Noto Sans CJK JP actually renders Japanese glyphs. The probe is removed before capture. Original site font choices are preserved.
6. Capture one image without stitching. Whole-page height and 80 million pixel limits reject oversized pages, rather than reporting a truncated image as success.

Missing/broken images are reported in `warnings` and diagnostics. They do not automatically fail an otherwise usable screenshot. There is no automatic network retry. Infinite scroll, virtualized lists that unload content, nested scroll containers, canvas/video, CSS background loading, cross-origin frames, and actively changing layouts are not guaranteed. The font probe verifies installed glyph rendering, not the correctness of every character in every part of the original site. DOM replacement-character counts and manual sample inspection complement it. Existing incorrect source encodings cannot be repaired reliably.

There is no persistent progress checkpoint: a restarted run starts the list again. A browser crash generally causes subsequent entries to fail until a new run. A Dataset infrastructure write failure aborts the run because the required result row cannot be persisted. Browser launch / invalid input errors are run-level failures. Hard platform shutdowns can interrupt output.

### Output and charging

Images are binary Key-value store records with `image/png` or `image/jpeg`. A collision-resistant key is generated for each input occurrence. Dataset rows contain:

- `index`, `url`, `finalUrl` (success), `imageUrl`, `imageKey`
- Actual `width`, `height`, requested `viewportWidth`, `viewportHeight`, `fullPage`, `format`
- `capturedAt` (UTC, immediately before screenshot), `finishedAt`, `durationSeconds` (capture plus KVS write; excludes Dataset/billing latency)
- `success`, `reason`, `warnings`, and non-content diagnostics on success

A failed row has null image fields and dimensions, null capture time, a finish time, elapsed seconds, and a reason. The `OUTPUT` KVS record contains counts and any billing uncertainty warning.

Local `imageUrl` values are `file://` URLs. Cloud URLs point to the Apify KVS record API; authorization may be required by storage access settings. No token is embedded. Moving the evidence directory invalidates historical absolute file URLs; use the relative `verification.imagePath` in `evidence/public-results.json` or `imageKey` in the adjacent KVS directory.

**Pricing (pay per event): $0.002 per successfully captured screenshot ($2.00 per 1,000), platform usage included.** The only charged event is `screenshot-success`, charged after the image and its Dataset row are saved. Failed URLs are not charged, and there is no start or per-row event. A cloud startup guard refuses to run if any other event has a positive price. Storage and charging are not one transaction: if a run is killed between saving and charging, a delivered image can go unbilled; a billing error is not retried. See [.actor/PRICING.md](.actor/PRICING.md) for the budget and limit handling.

### Privacy and responsible use

Public, unauthenticated pages only. **Login-required pages and CAPTCHA are unsupported.** The Actor never signs in, solves or bypasses a challenge, imports cookies, submits forms, or extracts contact/profile data. Visible password/CAPTCHA indicators are rejected; detection is heuristic and can miss a gate or reject a public page that embeds one.

Screenshots and URLs can themselves contain personal information already displayed by a public site. Supply only URLs you are permitted to capture and retain, without private tokens, and do not use the Actor to collect personal information. No additional analytics or personal-data extraction is implemented. Each context is destroyed after its item; no cookies or browsing profile are saved. Routine logs omit URLs and page content; failure reasons in the Dataset can contain a requested URL from a browser error.

**The user is responsible for robots.txt, the target site's terms, permissions, and appropriate use.** Robots rules are not automatically enforced. No legal compliance assertion is made. Basic URL checks reject credentials and common local targets, but this is not a complete SSRF/DNS-rebinding firewall. Use network-level egress controls for a deployment accepting untrusted inputs. Public HTTP requests and dependency downloads are necessary for the local test; project files are not uploaded anywhere.

### Verification

```sh
npm test
npm run test:public
```

`npm test` uses in-memory fixture responses with real Chromium and mocks for failure/billing ordering. `test:public` launches the actual SDK entry point for three public Japanese sites, one English site, mobile JPEG, and a mixed failure/success batch. It refuses to overwrite an existing evidence run: move `evidence/public`, `evidence/mobile`, and `evidence/mixed` first. It enables local SDK test charging and its charging-log Dataset; there is no real charge. With the pinned SDK, `ACTOR_USE_CHARGING_LOG_DATASET=true` writes `datasets/charging_log/`. The actual runs logged only `screenshot-success`; cloud automatic Dataset/start event pricing is separately guarded.

On the Apify platform, the Docker build and test runs succeeded (2026-11-04: 2 Japanese government pages in about 28 seconds and 8 pages in about 1 minute, all captured). The detailed local test report is kept outside this repository.

Official references: [Actor definition](https://docs.apify.com/actors/development/actor-definition/actor-json), [SDK charging](https://docs.apify.com/sdk/js/docs/concepts/pay-per-event), [Playwright screenshot API](https://playwright.dev/docs/api/class-page#page-screenshot).

# Actor input Schema

## `urls` (type: `array`):

HTTP(S) public pages only. No login or CAPTCHA.

## `width` (type: `integer`):

Use 390 for a narrow mobile viewport; this is not device emulation.

## `height` (type: `integer`):

Viewport height in pixels (the visible area before scrolling).

## `fullPage` (type: `boolean`):

Capture the whole page height instead of only the visible viewport.

## `waitUntil` (type: `string`):

networkidle may time out on continuously active pages.

## `extraWaitSeconds` (type: `number`):

Extra seconds to wait after loading and scrolling, for late fonts and images.

## `waitForSelector` (type: `string`):

Optional CSS selector, checked before scrolling.

## `format` (type: `string`):

Output image format. PNG is lossless; JPEG is smaller.

## `jpegQuality` (type: `integer`):

JPEG quality from 1 to 100 (used only when format is jpeg).

## `fixedElements` (type: `string`):

hide hides fixed elements and returns sticky elements to normal flow; may remove navigation.

## `navigationTimeoutSeconds` (type: `integer`):

Maximum seconds to wait for the page to load.

## `pageTimeoutSeconds` (type: `integer`):

Maximum seconds for one page in total (load, scroll, capture).

## `maxPageHeight` (type: `integer`):

Stop at this height in pixels for very long pages.

## Actor input object example

```json
{
  "width": 1280,
  "height": 900,
  "fullPage": true,
  "waitUntil": "load",
  "extraWaitSeconds": 2,
  "waitForSelector": "",
  "format": "png",
  "jpegQuality": 85,
  "fixedElements": "hide",
  "navigationTimeoutSeconds": 45,
  "pageTimeoutSeconds": 120,
  "maxPageHeight": 30000
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("driedsandwich/japanese-web-screenshot").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("driedsandwich/japanese-web-screenshot").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call driedsandwich/japanese-web-screenshot --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,driedsandwich/japanese-web-screenshot"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/haPdL8zu7wUo4Nvlo/builds/cU2p75GYPwEUAyX1b/openapi.json
