# Seo Robots Txt Checker (`eichan/seo-robots-txt-checker`) Actor

- **URL**: https://apify.com/eichan/seo-robots-txt-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

## Robots.txt Rules Checker

**One small SEO job:** request a website's public `/robots.txt` and show readable wildcard (`*`) and requested named-bot `Allow` / `Disallow` path rules plus declared `Sitemap` URLs.

### Who this is for

SEO specialists, site owners, and content teams who want a quick inspection of published crawler directives without a full-site audit or login.

### Input (copy into the Actor input form)

```json
{
  "siteUrl": "https://www.python.org/",
  "namedBot": "Nutch"
}
```

This is a real public target, checked on 2026-11-01. The Python site publishes wildcard and Nutch-specific rules. A domain like `www.python.org` (without scheme) also works and defaults to HTTPS. The path on `siteUrl` is ignored, since robots.txt is always read from the website root. `namedBot` defaults to `Nutch` in the form and to `Googlebot` if omitted from a direct API input.

### Output (example record)

One row for `*` and one for the requested named bot (unless that bot is `*`). Field shape is stable:

```json
{
  "robotsUrl": "https://www.python.org/robots.txt",
  "userAgent": "Nutch",
  "groupFound": true,
  "allowPaths": [],
  "disallowPaths": ["/"],
  "effectiveAllowPaths": [],
  "effectiveDisallowPaths": ["/"],
  "effectiveRuleSource": "Nutch",
  "sitemaps": [],
  "httpStatus": 200,
  "status": "ok",
  "message": "Robots.txt rules parsed.",
  "error": null
}
```

`disallowPaths`/`allowPaths` reflect **directives explicitly written for that agent**. If no agent-specific group exists, the `effective...Paths` fields fall back to the `*` group, and `effectiveRuleSource` is `*`. Repeated matching groups are combined. `Sitemap` directives are collected across the file, deduplicated, and repeated on each row.

**A 404 or 410 is a valid result, not a failed run:**

```json
{
  "robotsUrl": "https://site.example/robots.txt",
  "userAgent": "*",
  "groupFound": false,
  "allowPaths": [],
  "disallowPaths": [],
  "effectiveAllowPaths": [],
  "effectiveDisallowPaths": [],
  "effectiveRuleSource": null,
  "sitemaps": [],
  "httpStatus": 404,
  "status": "no_robots_txt",
  "message": "No robots.txt found (no restrictions).",
  "error": null
}
```

A network error or HTTP denial returns a plain-language `status: error` record and does **not** claim unrestricted crawling.

### Operation and limits

- Standard library only. No Apify SDK, web browser, search engine scraping, authentication, or third-party packages.
- Fetches **only** the specified host's root `/robots.txt`; nothing else is crawled. Follows at most four same-host redirects, with a 10-second timeout and a 500 KB response cap.
- Understands case-insensitive `User-agent`, `Allow`, `Disallow`, and `Sitemap` directive names; supports multiple agents in a group and multiple groups. Empty `Disallow:` does not mean blocked; it is omitted from blocked paths.
- **This is a directive inspector, not a complete RFC 9309 permission evaluator.** Patterns are shown as written; it does not apply longest-rule matching, prefix-based user-agent selection, query matching, crawl-delay semantics, or bot-vendor-specific interpretation. An empty list can mean no matching directive, not necessarily permission in every crawler implementation.
- HTTP 404/410 is treated as absent; other HTTP errors and connection problems are `status: error`. Robots.txt may be served dynamically, so readings are point-in-time.
- Rejects credentials in URLs, unsafe/private IP destinations, nonstandard ports, cross-host redirects, and HTTPS downgrade. `SEO_TEST_ALLOW_LOOPBACK=1` is only for local fixtures and must never be used in production.

### Use locally / test

```bash
ACTOR_INPUT_JSON='{"siteUrl":"https://www.python.org/","namedBot":"Nutch"}' python src/main.py
```

Local JSON items are written to `storage/datasets/default/`. Alternatively set `storage/key_value_stores/default/INPUT.json`. On Apify, the Actor reads input and pushes dataset items through **Apify REST APIs** using platform-provided token and default storage IDs (no Apify SDK).

Offline script-mode fixture tests and captured evidence:

```bash
python tests/run_smoke.py
python -m unittest discover -s tests -p 'test_*.py' -v
```

`tests/evidence/` contains actual `python src/main.py` output and dataset records. Local fixtures are used because public DNS was unavailable during packaging; live Apify or external HTTP operation was not run.

### Store configuration suggestion (NOT applied)

- Categories (max 3): **SEO tools**, **Marketing**, **Developer tools**.
- Pricing: **$0.01 per run**, regardless of whether a wildcard group exists. No billing or publication changes were made.
- See `store_metadata.json` for the proposal; this file is documentation, not a platform billing configuration.

# Actor input Schema

## `siteUrl` (type: `string`):

Website root or domain; always reads /robots.txt.

## `namedBot` (type: `string`):

Inspect this crawler separately from the wildcard group.

## Actor input object example

```json
{
  "siteUrl": "https://www.python.org/",
  "namedBot": "Nutch"
}
```

# 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 = {
    "siteUrl": "https://www.python.org/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("eichan/seo-robots-txt-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 = { "siteUrl": "https://www.python.org/" }

# Run the Actor and wait for it to finish
run = client.actor("eichan/seo-robots-txt-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 '{
  "siteUrl": "https://www.python.org/"
}' |
apify call eichan/seo-robots-txt-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,eichan/seo-robots-txt-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/MgL980EN9acoXW9kw/builds/qKolvfz6L2pwnXORT/openapi.json
