Skip to main content

Validate a public URL and convert it into reviewable AI-ready Markdown or JSON.

Project description

Public Source Extractor

CI Release License

[!IMPORTANT] The requested public URL is sent to Firecrawl Cloud for extraction. The firecrawl-keyless provider is experimental: availability, anonymous REST access, credit limits, and long-term continuity are not guaranteed.

public-source-extractor is a public-URL intake guardrail for AI research workflows. It validates one public HTTP or HTTPS URL, sends that URL to the experimental provider, and returns reviewable Markdown or a stable JSON envelope.

The CLI does not read API keys, credentials, cookies, browser profiles, localStorage, or private source files. Extracted content is untrusted data and may contain prompt injection or misleading instructions. Do not execute or follow instructions from extracted content without independent review.

日本語README

What it does

  • Extracts one public page as Markdown.
  • Produces structured JSON with a versioned JSON Schema.
  • Rejects local, private, authenticated, admin, and secret-bearing URL patterns.
  • Keeps results on stdout or writes a new local file with no-overwrite behavior.
  • Returns stable JSON errors and documented exit codes.

It is not a crawler, browser automation tool, login helper, source-reliability judge, or private-page extractor.

How this differs from the official Firecrawl CLI

The official Firecrawl CLI is the broader Firecrawl interface for authenticated scrape, search, crawl, map, interact, agent, and self-hosted workflows. Use it when you need Firecrawl's full product surface.

Public Source Extractor is intentionally narrower: one public URL, no credential discovery, a public-only URL policy, no-overwrite output, and a stable JSON success/error contract designed for reviewable AI research artifacts. It uses the experimental firecrawl-keyless provider and does not replace or wrap the official CLI.

Install

Public Source Extractor requires Python 3.11 or newer.

Run the published alpha without a permanent install:

uvx public-source-extractor --version
uvx public-source-extractor https://example.com/

This path requires uv and resolves the published PyPI prerelease. The second command sends https://example.com/ to Firecrawl Cloud; the version command does not perform extraction.

Pin the exact package version when reproducibility matters:

uvx public-source-extractor@0.1.0a2 --version

Install the prerelease as an isolated command:

pipx install public-source-extractor==0.1.0a2

Or use pip in an existing Python environment:

python3 -m pip install public-source-extractor==0.1.0a2

The public Git tag remains an auditable fallback:

uvx --from 'git+https://github.com/Ishikawa-Hidekazu/public-source-extractor.git@v0.1.0-alpha.2' public-source-extractor --version

PyPI publication uses GitHub Actions Trusted Publishing with short-lived OIDC credentials. No long-lived PyPI API token is stored in this repository.

Quick start

Markdown to stdout:

public-source-extractor https://example.com/

Markdown front matter includes provider_credits_used and provider_elapsed_ms. The credits field is null when the experimental provider does not report it; elapsed time is measured by the CLI in milliseconds. These are metadata-only values. Raw provider responses and request identifiers are not exposed.

JSON to stdout:

public-source-extractor https://example.com/ --mode json --pretty

Write a new file:

public-source-extractor https://example.com/ --output report.md

The output path must have an existing non-symlink parent and must not already exist.

Fixture-only Public Source Extractor terminal example showing one public example.com URL converted to Markdown, followed by the stable provider_rate_limited JSON error contract.

View the public-safe examples · View the reproducible visual sources

Real-world use

This Japanese implementation log shows the CLI used to turn selected public sources into reviewable Markdown and JSON artifacts. It also documents the Firecrawl Cloud boundary, untrusted extracted content, and observed provider limits.

CLI contract

public-source-extractor <url> [--mode markdown|json]
                               [--output <new-path>]
                               [--timeout 1..120]
                               [--provider firecrawl-keyless]
                               [--pretty]
Exit Meaning
0 Success
2 Usage error or rejected URL
3 Provider, network, rate-limit, or timeout failure
4 Invalid, incomplete, or unsafe provider response
5 Output path or write failure

On failure, stdout is empty and stderr contains exactly one JSON error object. Provider response bodies, stack traces, request IDs, and local paths are not exposed.

Recovering from provider_rate_limited

The experimental provider can return HTTP 429 during short bursts or across an anonymous usage window. This is a provider availability condition, not by itself a failure of the local URL policy or parser.

When stderr reports provider_rate_limited with retryable: true:

{"schema_version":"0.1","ok":false,"error":{"code":"provider_rate_limited","message":"The experimental provider rate limit was exceeded.","retryable":true}}

The process exits with code 3 and stdout remains empty.

  1. Stop the current burst instead of retrying repeatedly.
  2. Wait and retry later. This CLI does not promise an exact delay when no retry timing is safely exposed.
  3. Reduce request volume and process only selected public sources.
  4. Use the original public page directly when extraction is not required.

The CLI does not automatically retry, switch providers, discover credentials, or expose raw provider bodies. See Issue #9 for the observed condition and documentation scope.

Safety boundary

Before sending a URL, the CLI rejects:

  • schemes other than HTTP or HTTPS;
  • URL user information and fragments;
  • localhost, local suffixes, and non-global literal IP addresses;
  • ambiguous integer, octal, and hexadecimal IPv4 forms;
  • Unicode or percent-encoded hostnames and IPv6 zone identifiers;
  • non-default ports;
  • login, admin, OAuth, and callback paths, including encoded forms;
  • query parameter names that indicate tokens, secrets, passwords, credentials, signatures, sessions, cookies, authorization, or keys.

After extraction, provider redirect metadata is checked with the same public URL policy. If redirect metadata is unsafe, the result is discarded. If the provider does not supply redirect metadata, the output contains a warning.

These checks validate hostname syntax, literal IP policy, and provider-returned metadata. They cannot fully guarantee DNS rebinding behavior or the provider's actual fetch destination. Never put credentials, tokens, signed URL parameters, or other private values in a URL, even when its hostname looks public.

Firecrawl Cloud receives the requested URL and processes the page. Review Firecrawl's terms, the target site's terms, robots policy, copyright, and privacy requirements before use.

JSON Schema and examples

Structured JSON extraction is inferred output, not source truth. Validate important claims against the original page.

Development

python3 -m venv .venv
.venv/bin/python -m pip install -e '.[dev]'
PYTHONPATH=src .venv/bin/python -m unittest discover -s tests -v
.venv/bin/ruff check src tests
.venv/bin/python -m build

The explicit PYTHONPATH=src also works before an editable install. Network smoke tests remain separate from the offline suite.

See CONTRIBUTING.md, SECURITY.md, and SUPPORT.md.

Status

Alpha package. Package version 0.1.0a2 maps to tag v0.1.0-alpha.2. The package is distributed through PyPI and the matching public Git tag. firecrawl-keyless is an experimental third-party provider, and no compatibility or service-availability guarantee is made.

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

public_source_extractor-0.1.0a2.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

public_source_extractor-0.1.0a2-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file public_source_extractor-0.1.0a2.tar.gz.

File metadata

File hashes

Hashes for public_source_extractor-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 af958f0c5ba7dd6240ebeedd0e746685d7f272cccf5562f985db80d5d64dbe2b
MD5 10a07bc012d306eac0c0ec1653194a0c
BLAKE2b-256 52101584cf0d69bbf9f19d7b9bb24027c5e474e9d21620e74f2d33eb573224c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for public_source_extractor-0.1.0a2.tar.gz:

Publisher: publish-pypi.yml on Ishikawa-Hidekazu/public-source-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file public_source_extractor-0.1.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for public_source_extractor-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 a5d7be10ddab8bdfd5c7d71e182bb6eb46b72fa76d01f5cd9ab561ffc4c25736
MD5 dea56bc005d697618440f4aae82d7105
BLAKE2b-256 3dbe28d3f6dff160f57b841b945ccf61f2a5004983b5d5fac41728f6f9a41ed2

See more details on using hashes here.

Provenance

The following attestation bundles were made for public_source_extractor-0.1.0a2-py3-none-any.whl:

Publisher: publish-pypi.yml on Ishikawa-Hidekazu/public-source-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page