# actor-template

An Apify-style actor in plain Python: input schema -> polite crawl (robots.txt, delay, same host) -> dataset items in Apify's local storage layout. Runs locally or as a container.

- **Space:** scraping-automation-public (https://github.com/Tech-Realm/space-scraping-automation-public/tree/main/actor-template)
- **Level:** L2 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3
- **Routes:** local; checks: 1
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use scraping-automation-public/actor-template` or MCP `get_pack scraping-automation-public/actor-template`
- **Files:** CHANGELOG.md, code/.actor/Dockerfile, code/.actor/actor.json, code/.actor/input_schema.json, code/check_actor.sh, code/main.py, code/with_local_site.sh, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/fixtures/site/about.html, outcome/fixtures/site/index.html, outcome/fixtures/site/robots.txt, outcome/results.json, pack.yaml, refs/refs.yaml, spec/SPEC.md, spec/source.md

## Purpose (spec/SPEC.md)

An Apify-style actor in plain Python: input schema -> polite crawl (robots.txt, delay, same host) -> dataset items in Apify's local storage layout. Runs locally or as a container.

## Goal

A reusable actor skeleton that turns an input (start URLs, limits) into a dataset of page items, runnable locally and deployable to Apify unchanged in shape.

## Routes (free first)

1. `local` (local): `python3 code/main.py --storage ./storage --input <json>` - runs on any machine; no account

## Steps

1. Copy code/ into a new folder; edit `Page` (what to extract) and the `item` dict in main.py.
2. Describe the input in code/.actor/input_schema.json (Apify renders it as a form).
3. Run locally: `python3 code/main.py --storage ./storage --input '{"startUrls": ["https://example.com"], "maxPages": 5}'`.
4. Read results from storage/datasets/default/*.json and the summary from storage/key_value_stores/default/OUTPUT.json.
5. Deploy to Apify: `apify push` from the folder with .actor/ (needs the Apify CLI and APIFY_TOKEN), or run the Dockerfile anywhere on a schedule (scheduled-job pack).

## Edge cases

- Pages that need JavaScript return empty shells: switch the fetch to Playwright (browser-automation space) for those hosts only.
- Respect robots.txt and add a delay; many sites block bursts (403/429) and some block plain curl (Indeed, Glassdoor) while others work (see ats-job-boards).
- Cap pages and bytes per page so a crawl loop can't run away.
- Results can contain personal data (names, emails, phones): store only what the job needs and never publish it.

## Don'ts

- Don't bypass logins, paywalls or CAPTCHAs.
- Don't crawl a client's competitor or any site at high rate without the owner's OK.
- Don't commit storage/ (datasets) to a space repo.



---

Canonical URL: https://logicpacks.io/packs/scraping-automation-public/actor-template

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
