DEV Community

coreclaw
coreclaw

Posted on

CoreClaw Workers: How to Deploy a Custom Web Scraper Without DevOps

CoreClaw Workers: How to Deploy a Custom Web Scraper Without DevOps

You can deploy a custom web scraper to managed cloud workers and skip the server, proxy pool, and job-queue setup. The practical path is to write a small scraping function, wrap it as a worker job, and let a managed platform handle scheduling, retries, and delivery. This article shows a complete Python workflow you can adapt to any public data source.

TL;DR

  • Problem: Self-hosting a scraper means managing servers, proxies, retries, storage, and observability.
  • Solution: Deploy the scraper as a managed worker through CoreClaw Workers and focus on the extraction logic.
  • Outcome: You get a callable endpoint that runs your scraper in the cloud, handles execution, and returns structured JSON.
  • Verified links: CoreClaw product store, CoreClaw pricing.

Why self-hosting a scraper becomes a DevOps project

A scraper that works on your laptop rarely works in production without extra work. You need:

  1. A server or container that stays running.
  2. A proxy or IP rotation strategy to avoid blocks.
  3. Retry logic with exponential backoff and jitter.
  4. A queue or scheduler for recurring jobs.
  5. Storage and a way to normalize output.
  6. Logs and alerts so you know when a target changes.

Each of these is solvable, but together they turn a small data task into infrastructure work. If the goal is to collect public web data for a product, a report, or an AI agent, most teams would rather spend time on the data than on the plumbing.

What CoreClaw Workers does

CoreClaw Workers gives you a managed environment to deploy scraper scripts. You provide the extraction logic or choose from the CoreClaw product store, and the platform handles execution, scaling, retries, and result delivery. You call the worker through an HTTP endpoint or schedule it to run on an interval.

The key idea is separation of concerns:

Concern You handle Platform handles
Extraction logic Yes No
Target URLs and parameters Yes No
Servers and runtime No Yes
Proxies and IP rotation No Yes
Retries and queueing No Yes
Structured result delivery No Yes

This lets you ship a scraper the same way you ship a serverless function: write code, configure inputs, and get a callable URL.

Build and deploy a custom scraper

This workflow uses Python and environment variables for anything account-specific. You can run the same script locally for testing and then point it at your CoreClaw worker endpoint for production runs.

Step 1: Write a small scraping function

Keep the scraper focused on one public data source. The example below extracts article titles and URLs from a public index page. It uses standard Python libraries plus requests, which most environments already have.

import os
import re
import json
import time
from urllib.parse import urljoin

import requests
from bs4 import BeautifulSoup


def scrape_index_page(url):
    """
    Extract article links from a public index page.
    Returns a list of dicts with title, url, and fetched_at.
    """
    response = requests.get(url, timeout=30)
    response.raise_for_status()

    soup = BeautifulSoup(response.text, "html.parser")
    records = []

    for link in soup.find_all("a", href=True):
        href = link["href"]
        title = link.get_text(strip=True)
        if title and "/article/" in href:
            records.append({
                "title": title,
                "url": urljoin(url, href),
                "source_url": url,
                "fetched_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
            })

    return records


if __name__ == "__main__":
    target = os.environ.get("TARGET_URL", "https://example.com/blog")
    results = scrape_index_page(target)
    print(json.dumps(results[:5], indent=2))
Enter fullscreen mode Exit fullscreen mode

Install dependencies with:

pip install requests beautifulsoup4
Enter fullscreen mode Exit fullscreen mode

Step 2: Create a worker payload

A worker payload tells the platform which function to run and what inputs to pass. Keep the payload simple: a target URL, a few parameters, and a stable job name.

import os
import json
import time
import requests

# Copy these values from your CoreClaw Workers dashboard.
WORKER_ENDPOINT = os.environ["WORKER_ENDPOINT"]
WORKER_API_KEY = os.environ["WORKER_API_KEY"]

job_payload = {
    "job_name": "blog-index-scraper",
    "target_url": "https://example.com/blog",
    "output_schema": "article_links",
    "requested_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
}

headers = {
    "Authorization": f"Bearer {WORKER_API_KEY}",
    "Content-Type": "application/json",
}

response = requests.post(
    WORKER_ENDPOINT,
    headers=headers,
    json=job_payload,
    timeout=60,
)
print(response.status_code)
print(json.dumps(response.json(), indent=2))
Enter fullscreen mode Exit fullscreen mode

The WORKER_ENDPOINT is the full URL shown in the CoreClaw Workers console. Do not hard-code it. Endpoint paths and versions change, so always copy the current value from the dashboard.

Step 3: Poll for results

Managed workers are asynchronous. After you submit a job, poll the status endpoint until the run completes or fails.

import os
import json
import time
import requests

WORKER_API_KEY = os.environ["WORKER_API_KEY"]
status_url = os.environ["WORKER_STATUS_URL"]

def poll_for_result(status_url, api_key, max_attempts=30, sleep_seconds=10):
    headers = {"Authorization": f"Bearer {api_key}"}

    for attempt in range(max_attempts):
        response = requests.get(status_url, headers=headers, timeout=30)
        response.raise_for_status()
        data = response.json()

        if data.get("status") in ("completed", "failed"):
            return data

        print(f"Attempt {attempt + 1}: status={data.get('status')}")
        time.sleep(sleep_seconds)

    raise TimeoutError("Worker did not finish within the polling window")


result = poll_for_result(status_url, WORKER_API_KEY)
print(json.dumps(result, indent=2))
Enter fullscreen mode Exit fullscreen mode

Step 4: Normalize and store the output

Once the worker returns structured JSON, normalize it into the shape your pipeline expects. The example below writes results to a local JSONL file, but you can just as easily send them to a database, CRM, or AI agent context store.

import json
from pathlib import Path

records = result.get("output", {}).get("records", [])
output_path = Path("data") / "articles.jsonl"
output_path.parent.mkdir(parents=True, exist_ok=True)

with output_path.open("a", encoding="utf-8") as f:
    for record in records:
        f.write(json.dumps(record, ensure_ascii=False) + "\n")

print(f"Appended {len(records)} records to {output_path}")
Enter fullscreen mode Exit fullscreen mode

Expected output shape

A successful run returns metadata plus the extracted records. The exact field names depend on your worker configuration, but the structure usually looks like this:

{
  "job_id": "job_9f8a7b6c",
  "status": "completed",
  "started_at": "2026-09-09T08:15:00Z",
  "finished_at": "2026-09-09T08:15:12Z",
  "output": {
    "schema": "article_links",
    "record_count": 24,
    "records": [
      {
        "title": "Deploying Scrapers Without Servers",
        "url": "https://example.com/blog/deploying-scrapers",
        "source_url": "https://example.com/blog",
        "fetched_at": "2026-09-09T08:15:05Z"
      }
    ]
  }
}
Enter fullscreen mode Exit fullscreen mode

Use this structure to build checks in your pipeline:

  • status must be completed before you ingest records.
  • record_count should match the length of records.
  • source_url and fetched_at give you traceability for compliance and freshness.

Deployment checklist

Before you move the script from your laptop to a managed worker, confirm these items:

  • [ ] The target site exposes the data publicly without authentication.
  • [ ] You have copied the current WORKER_ENDPOINT from the CoreClaw Workers console.
  • [ ] Your scraper function handles HTTP errors and returns empty results gracefully.
  • [ ] You store the API key in an environment variable, not in the source code.
  • [ ] You respect the target site's robots.txt and terms of service.
  • [ ] You have a retention plan for the collected data.
  • [ ] You know how to check worker logs when a run fails.

Business use cases

A managed worker approach fits several recurring data needs:

  1. Lead list refresh. Run a worker every morning to collect public business listings, then load the structured JSON into a CRM or outreach tool.
  2. Price monitoring. Schedule product pages to be checked on an interval and compare current prices against a baseline.
  3. Content research. Collect article titles, publish dates, and authors from public blogs or news sites for trend analysis.
  4. AI agent context. Feed public web data into an agent's retrieval pipeline so answers are grounded in current sources.
  5. Compliance monitoring. Track public regulator pages, terms of service, or announcement boards for changes.

Build it yourself vs. CoreClaw Workers

Dimension Self-hosted scraper CoreClaw Workers
Best for Full control, custom infrastructure, large existing ops team Teams that want to focus on data, not servers
Setup model Provision servers, proxies, queues, storage Deploy function or select from product store
Data coverage Whatever you code Depends on worker logic or ready-made scraper
Output format You design and maintain JSON by default; configurable
Maintenance burden High: OS, proxies, anti-detection, alerting Low: platform handles runtime and retries
Integration path Custom webhooks, queues, databases HTTP endpoint, scheduling, direct delivery
Quota/freshness Set by your own infrastructure Confirm current limits on the pricing page
Pricing verification Your own cloud and proxy bills Check official pricing before scaling

The trade-off is control versus operational speed. If your core competency is using the data, not running scraping infrastructure, a managed worker is usually the faster path to production.

Limitations and compliance

Managed workers are not a bypass for access controls. Keep these limits in mind:

  • Public data only. Do not use a worker to extract private, authenticated, or restricted content.
  • Terms of service. Follow the target site's terms and robots directives.
  • Rate limits. Even with managed proxies, aggressive pacing can still trigger blocks or violate terms.
  • Layout changes. A scraper breaks when the target site changes markup. Plan for periodic maintenance.
  • Data retention. Store only what you need and delete data when it is no longer useful.
  • Regional rules. Confirm that your use case complies with local privacy and data-protection laws.

A worker removes infrastructure pain, but it does not remove your responsibility to collect data lawfully.

FAQ

Is there an official API to deploy a worker?

Yes. The CoreClaw Workers console provides the endpoint and credentials you need to submit jobs programmatically. Copy the endpoint from the dashboard instead of guessing a URL.

What data fields does a worker return?

The worker returns whatever your scraping function produces, wrapped in a standard envelope with job_id, status, timestamps, and an output.records array. You control the record schema.

How often should the workflow run?

It depends on freshness needs. Daily is common for price and lead monitoring. Weekly or monthly works for slower-moving sources. Start conservative and increase frequency only if the data changes often enough to justify it.

What happens when a page layout changes?

Your scraper function will return fewer or different fields. Monitor record_count and run a validation step that alerts you when expected fields are missing. That is the signal to update your selectors.

Can this connect to n8n, a CRM, or an AI agent?

Yes. The worker output is JSON, so you can send it to any webhook, no-code tool, database, or agent context store. Keep the API key in the receiving system's secret manager.

What should I verify before production use?

Confirm the target site allows public access, test your scraper on a small URL set, validate the output schema, and review the current pricing and quota details on the CoreClaw pricing page.

Do I need to manage proxies?

No. The platform handles proxy rotation and runtime infrastructure. You only write and maintain the extraction logic.

Summary and next steps

Deploying a custom scraper does not have to mean becoming a DevOps team. With CoreClaw Workers, you write the extraction logic, submit a job to a managed endpoint, and get structured JSON back without managing servers or proxies.

Start with a single public data source, test the scraper locally, then move the same payload to a worker. Add validation, scheduling, and storage only after the first end-to-end run succeeds.

Related reading

Top comments (0)