# Seo Content Readability Checker (`eichan/seo-content-readability-checker`) Actor

- **URL**: https://apify.com/eichan/seo-content-readability-checker.md
- **Developed by:** [Eichan Jolly](https://apify.com/eichan) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.01 / actor start

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

## Content Readability Checker

### What it does

Fetches one HTML page, prefers its `<main>` section (or `[role="main"]`), falls back to `<article>` and then non-boilerplate body text; excludes navigation, header, footer, scripts, styles, forms, and other boilerplate. It calculates word and sentence counts plus Flesch Reading Ease and Flesch–Kincaid Grade using deterministic formulas.

### Who it is for

Content editors, SEO specialists, site owners, and writers who want a quick approximate reading-difficulty signal from a public article.

### Input

Supply **one** publicly reachable HTTP/HTTPS URL (no account or API key):

```json
{
  "url": "https://example.com/"
}
```

This is also the prefilled Store example; it is a real public page. It may change after publication. The only configurable field is `url`. The Actor will request the target site’s `/robots.txt` and, if permitted, fetch the page itself.

### Output

`sourceUrl` (string or null), `wordCount` (integer), `sentenceCount` (integer), `averageWordsPerSentence` (number or null), `fleschReadingEase` (number or null), `fleschKincaidGrade` (number or null), `readingTimeMinutes` (integer), `status` (`ok`, `no_text`, or `error`), `error` (string or null).

Example actual dataset item, recorded by the included local script-mode smoke test (the `127.0.0.1` address is a disposable test fixture, **not** the public prefill):

```json
{
  "sourceUrl": "http://127.0.0.1:43101/page",
  "wordCount": 7,
  "sentenceCount": 2,
  "averageWordsPerSentence": 3.5,
  "fleschReadingEase": 118.68,
  "fleschKincaidGrade": -2.42,
  "readingTimeMinutes": 1,
  "status": "ok",
  "error": null
}
```

The fixture contains navigation, a main section, and footer; only the main section contributes to the single record. See `tests/evidence/smoke_dataset.json` for **all** actual smoke-test records, including malformed JSON-LD when applicable.

### How to run

On Apify, paste the URL in the input form and run the Actor. The input is loaded in this exact precedence order:

1. Parse `ACTOR_INPUT_JSON` if set (including when it contains invalid JSON; no silent fallback).
2. Otherwise use `GET https://api.apify.com/v2/key-value-stores/{APIFY_DEFAULT_KEY_VALUE_STORE_ID}/records/INPUT` with `Authorization: Bearer {APIFY_TOKEN}` when the default key-value store ID exists.
3. Otherwise read `./storage/key_value_stores/default/INPUT.json` relative to the process working directory.

On Apify, results are appended to the default dataset by an authorized REST API `POST`. Locally, one JSON file per item appears under `storage/datasets/default/`.

To run locally from this Actor folder:

```bash
export ACTOR_INPUT_JSON='{"url": "https://example.com/"}'
python src/main.py
```

Or put the same JSON in `storage/key_value_stores/default/INPUT.json` and run `python src/main.py` with `ACTOR_INPUT_JSON` unset. Only Python 3.12+ standard-library modules are required.

To rerun verifiable offline tests:

```bash
python -m unittest discover -s tests -p test_actor.py -v
python tests/run_smoke.py
```

The smoke runner launches a local HTTP fixture and executes **`python src/main.py` as a subprocess** with a valid `ACTOR_INPUT_JSON`. It writes the full terminal output, valid input, and produced dataset records to `tests/evidence/`. `ACTOR_TEST_ALLOW_LOOPBACK=1` is only set by this local test runner, never by default.

### Limits and error handling

**Readability scores are estimates designed for English text, not validated linguistic measurements.** Word tokens use an ASCII-English word/number matcher; syllables are estimated from vowel groups and a trailing-`e` heuristic. Sentence segmentation is punctuation-based and can miscount abbreviations. Text that is added with JavaScript is not analyzed. Flesch scores may naturally exceed 100 or fall below zero and grade values can be negative for exceptionally short/simple text. When there is no extractable text, `status` is `no_text` with null scores. Does not assess meaning, factual accuracy, or content quality.

- One page per run. No general crawling, search-result scraping, login, or third-party Python packages.
- Two HTTP requests maximum in a normal run (robots.txt and the page), with at most three same-host redirects for each request. The page is limited to 2 MB; robots.txt is limited to 200 KB; each request has a 12-second timeout.
- By default, local/private/reserved IP addresses and nonstandard ports are rejected; cross-host redirects are rejected. The actor checks DNS addresses but is **not** a hardened defence against DNS rebinding on hostile hostnames. Use only public sites you are authorized to inspect.
- Robots.txt opt-outs are respected; missing robots.txt (404/410) is allowed. If the page cannot be fetched, or input is invalid, the Actor writes a stable `error` dataset record and prints a short message, not a traceback. A failed run may exit nonzero even if its error item is written.
- Web content, robots policies, and site availability change. The public example is not part of the offline unit/smoke fixture, so cloud execution must be checked after deploying.

### Suggested Store categories and pricing

**Categories:** SEO tools, Content marketing, Marketing.

Suggested **$0.01 per run**. This is only a recommendation; no monetization or billing is configured.

### Deployment state

Source-only deliverable, not published. No Apify cloud runs or billing configuration have been performed.

# Actor input Schema

## `url` (type: `string`):

One public HTTP or HTTPS page URL to inspect. No authentication or site crawling.

## Actor input object example

```json
{
  "url": "https://example.com/"
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing the Actor's result items

# 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 = {
    "url": "https://example.com/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("eichan/seo-content-readability-checker").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 = { "url": "https://example.com/" }

# Run the Actor and wait for it to finish
run = client.actor("eichan/seo-content-readability-checker").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 '{
  "url": "https://example.com/"
}' |
apify call eichan/seo-content-readability-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,eichan/seo-content-readability-checker"
        }
    }
}
```

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/b0XSGvhQY8TW0JrFK/builds/SIZpVWh6kFBhbAffc/openapi.json
