public-source-extractor 0.1.0a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- public_source_extractor/__init__.py +3 -0
- public_source_extractor/__main__.py +5 -0
- public_source_extractor/cli.py +61 -0
- public_source_extractor/errors.py +58 -0
- public_source_extractor/output.py +123 -0
- public_source_extractor/provider.py +153 -0
- public_source_extractor/schemas/__init__.py +0 -0
- public_source_extractor/schemas/output-v0.1.schema.json +90 -0
- public_source_extractor/url_policy.py +170 -0
- public_source_extractor-0.1.0a2.dist-info/METADATA +230 -0
- public_source_extractor-0.1.0a2.dist-info/RECORD +15 -0
- public_source_extractor-0.1.0a2.dist-info/WHEEL +5 -0
- public_source_extractor-0.1.0a2.dist-info/entry_points.txt +2 -0
- public_source_extractor-0.1.0a2.dist-info/licenses/LICENSE +22 -0
- public_source_extractor-0.1.0a2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Sequence
|
|
8
|
+
|
|
9
|
+
from . import __version__
|
|
10
|
+
from .errors import ExtractorError, InputRejected
|
|
11
|
+
from .output import build_success_envelope, render_json, render_markdown, write_new_file_atomic
|
|
12
|
+
from .provider import FirecrawlKeylessProvider
|
|
13
|
+
from .url_policy import validate_public_url
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class StableArgumentParser(argparse.ArgumentParser):
|
|
17
|
+
def error(self, _message: str) -> None:
|
|
18
|
+
raise InputRejected()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
22
|
+
parser = StableArgumentParser(
|
|
23
|
+
prog="public-source-extractor",
|
|
24
|
+
description="Convert one public URL into Markdown or a stable JSON envelope.",
|
|
25
|
+
)
|
|
26
|
+
parser.add_argument("url", help="Public HTTP or HTTPS URL.")
|
|
27
|
+
parser.add_argument("--mode", choices=("markdown", "json"), default="markdown")
|
|
28
|
+
parser.add_argument("--output", type=Path, help="Write to a new file instead of stdout.")
|
|
29
|
+
parser.add_argument("--timeout", type=int, default=60, metavar="SECONDS")
|
|
30
|
+
parser.add_argument("--provider", choices=("firecrawl-keyless",), default="firecrawl-keyless")
|
|
31
|
+
parser.add_argument("--pretty", action="store_true", help="Pretty-print JSON output.")
|
|
32
|
+
parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
|
|
33
|
+
return parser
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def run(argv: Sequence[str] | None = None) -> int:
|
|
37
|
+
try:
|
|
38
|
+
args = build_parser().parse_args(argv)
|
|
39
|
+
if not 1 <= args.timeout <= 120:
|
|
40
|
+
raise InputRejected()
|
|
41
|
+
validate_public_url(args.url)
|
|
42
|
+
provider = FirecrawlKeylessProvider()
|
|
43
|
+
result = provider.extract(args.url, args.mode, args.timeout)
|
|
44
|
+
envelope = build_success_envelope(args.url, args.mode, result)
|
|
45
|
+
rendered = (
|
|
46
|
+
render_markdown(envelope)
|
|
47
|
+
if args.mode == "markdown"
|
|
48
|
+
else render_json(envelope, args.pretty)
|
|
49
|
+
)
|
|
50
|
+
if args.output is None:
|
|
51
|
+
sys.stdout.write(rendered)
|
|
52
|
+
else:
|
|
53
|
+
write_new_file_atomic(args.output, rendered)
|
|
54
|
+
return 0
|
|
55
|
+
except ExtractorError as exc:
|
|
56
|
+
sys.stderr.write(json.dumps(exc.envelope(), ensure_ascii=False) + "\n")
|
|
57
|
+
return exc.exit_code
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def main() -> int:
|
|
61
|
+
return run()
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ExtractorError(Exception):
|
|
5
|
+
code = "extractor_error"
|
|
6
|
+
exit_code = 1
|
|
7
|
+
retryable = False
|
|
8
|
+
public_message = "Extraction failed."
|
|
9
|
+
|
|
10
|
+
def __init__(self, message: str | None = None) -> None:
|
|
11
|
+
super().__init__(message or self.public_message)
|
|
12
|
+
|
|
13
|
+
def envelope(self) -> dict[str, object]:
|
|
14
|
+
return {
|
|
15
|
+
"schema_version": "0.1",
|
|
16
|
+
"ok": False,
|
|
17
|
+
"error": {
|
|
18
|
+
"code": self.code,
|
|
19
|
+
"message": self.public_message,
|
|
20
|
+
"retryable": self.retryable,
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class InputRejected(ExtractorError):
|
|
26
|
+
code = "input_rejected"
|
|
27
|
+
exit_code = 2
|
|
28
|
+
public_message = "The URL was rejected by the public-source safety policy."
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ProviderFailure(ExtractorError):
|
|
32
|
+
code = "provider_failure"
|
|
33
|
+
exit_code = 3
|
|
34
|
+
retryable = True
|
|
35
|
+
public_message = "The extraction provider is unavailable or rejected the request."
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class ProviderRateLimited(ProviderFailure):
|
|
39
|
+
code = "provider_rate_limited"
|
|
40
|
+
public_message = "The experimental provider rate limit was exceeded."
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class ProviderTimeout(ProviderFailure):
|
|
44
|
+
code = "provider_timeout"
|
|
45
|
+
public_message = "The extraction provider timed out."
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class InvalidProviderResponse(ExtractorError):
|
|
49
|
+
code = "invalid_provider_response"
|
|
50
|
+
exit_code = 4
|
|
51
|
+
public_message = "The extraction provider returned an invalid or unsafe response."
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class OutputFailure(ExtractorError):
|
|
55
|
+
code = "output_failure"
|
|
56
|
+
exit_code = 5
|
|
57
|
+
public_message = "The output file could not be written safely."
|
|
58
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import tempfile
|
|
6
|
+
from datetime import datetime, timezone
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from .errors import OutputFailure
|
|
11
|
+
from .provider import FirecrawlKeylessProvider, ProviderResult
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def build_success_envelope(
|
|
15
|
+
requested_url: str,
|
|
16
|
+
mode: str,
|
|
17
|
+
result: ProviderResult,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
warnings = [
|
|
20
|
+
{
|
|
21
|
+
"code": "experimental_provider",
|
|
22
|
+
"message": "Keyless availability and limits are not guaranteed.",
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
if result.resolved_url is None:
|
|
26
|
+
warnings.append(
|
|
27
|
+
{
|
|
28
|
+
"code": "resolved_url_unavailable",
|
|
29
|
+
"message": "The provider did not return redirect metadata for post-checking.",
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
return {
|
|
33
|
+
"schema_version": "0.1",
|
|
34
|
+
"ok": True,
|
|
35
|
+
"source": {
|
|
36
|
+
"requested_url": requested_url,
|
|
37
|
+
"resolved_url": result.resolved_url,
|
|
38
|
+
"fetched_at": datetime.now(timezone.utc).isoformat(timespec="seconds").replace(
|
|
39
|
+
"+00:00", "Z"
|
|
40
|
+
),
|
|
41
|
+
},
|
|
42
|
+
"mode": mode,
|
|
43
|
+
"content": result.content,
|
|
44
|
+
"metadata": {
|
|
45
|
+
"title": result.title,
|
|
46
|
+
"description": result.description,
|
|
47
|
+
"content_type": result.content_type,
|
|
48
|
+
"source_http_status": result.source_http_status,
|
|
49
|
+
},
|
|
50
|
+
"provider": {
|
|
51
|
+
"name": FirecrawlKeylessProvider.name,
|
|
52
|
+
"access": FirecrawlKeylessProvider.access,
|
|
53
|
+
"http_status": result.provider_http_status,
|
|
54
|
+
"credits_used": result.credits_used,
|
|
55
|
+
"elapsed_ms": result.elapsed_ms,
|
|
56
|
+
},
|
|
57
|
+
"warnings": warnings,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def render_markdown(envelope: dict[str, Any]) -> str:
|
|
62
|
+
source = envelope["source"]
|
|
63
|
+
metadata = envelope["metadata"]
|
|
64
|
+
provider = envelope["provider"]
|
|
65
|
+
front_matter = {
|
|
66
|
+
"schema_version": envelope["schema_version"],
|
|
67
|
+
"source_url": source["requested_url"],
|
|
68
|
+
"resolved_url": source["resolved_url"],
|
|
69
|
+
"fetched_at": source["fetched_at"],
|
|
70
|
+
"title": metadata["title"],
|
|
71
|
+
"content_type": metadata["content_type"],
|
|
72
|
+
"source_http_status": metadata["source_http_status"],
|
|
73
|
+
"provider": provider["name"],
|
|
74
|
+
"provider_access": provider["access"],
|
|
75
|
+
"provider_credits_used": provider["credits_used"],
|
|
76
|
+
"provider_elapsed_ms": provider["elapsed_ms"],
|
|
77
|
+
}
|
|
78
|
+
lines = ["---"]
|
|
79
|
+
lines.extend(
|
|
80
|
+
f"{key}: {json.dumps(value, ensure_ascii=False)}" for key, value in front_matter.items()
|
|
81
|
+
)
|
|
82
|
+
lines.extend(["---", "", str(envelope["content"]), ""])
|
|
83
|
+
return "\n".join(lines)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def render_json(envelope: dict[str, Any], pretty: bool) -> str:
|
|
87
|
+
indent = 2 if pretty else None
|
|
88
|
+
return json.dumps(envelope, ensure_ascii=False, indent=indent, separators=None) + "\n"
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def write_new_file_atomic(path: Path, content: str) -> None:
|
|
92
|
+
try:
|
|
93
|
+
parent = path.parent.resolve(strict=True)
|
|
94
|
+
_reject_symlink_components(path.parent)
|
|
95
|
+
if not parent.is_dir() or path.exists() or path.is_symlink():
|
|
96
|
+
raise OutputFailure()
|
|
97
|
+
|
|
98
|
+
fd, temporary_name = tempfile.mkstemp(prefix=f".{path.name}.", dir=parent)
|
|
99
|
+
temporary = Path(temporary_name)
|
|
100
|
+
try:
|
|
101
|
+
with os.fdopen(fd, "w", encoding="utf-8", newline="\n") as handle:
|
|
102
|
+
handle.write(content)
|
|
103
|
+
handle.flush()
|
|
104
|
+
os.fsync(handle.fileno())
|
|
105
|
+
os.link(temporary, path)
|
|
106
|
+
finally:
|
|
107
|
+
temporary.unlink(missing_ok=True)
|
|
108
|
+
except OutputFailure:
|
|
109
|
+
raise
|
|
110
|
+
except (OSError, RuntimeError) as exc:
|
|
111
|
+
raise OutputFailure() from exc
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _reject_symlink_components(path: Path) -> None:
|
|
115
|
+
# Inspect the caller-selected path without resolving it first. macOS exposes
|
|
116
|
+
# /tmp and /var as stable platform aliases, so only those two are exempt.
|
|
117
|
+
platform_aliases = {Path("/tmp"), Path("/var")}
|
|
118
|
+
absolute = path.absolute()
|
|
119
|
+
current = Path(absolute.anchor)
|
|
120
|
+
for component in absolute.parts[1:]:
|
|
121
|
+
current /= component
|
|
122
|
+
if current.is_symlink() and current not in platform_aliases:
|
|
123
|
+
raise OutputFailure()
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import socket
|
|
5
|
+
import time
|
|
6
|
+
import urllib.error
|
|
7
|
+
import urllib.request
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
from typing import Any, Protocol
|
|
10
|
+
|
|
11
|
+
from .errors import (
|
|
12
|
+
InputRejected,
|
|
13
|
+
InvalidProviderResponse,
|
|
14
|
+
ProviderFailure,
|
|
15
|
+
ProviderRateLimited,
|
|
16
|
+
ProviderTimeout,
|
|
17
|
+
)
|
|
18
|
+
from .url_policy import validate_provider_resolved_url
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
FIRECRAWL_ENDPOINT = "https://api.firecrawl.dev/v2/scrape"
|
|
22
|
+
MAX_RESPONSE_BYTES = 10 * 1024 * 1024
|
|
23
|
+
|
|
24
|
+
STRUCTURED_SCHEMA: dict[str, Any] = {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"title": {"type": "string"},
|
|
28
|
+
"summary": {"type": "string"},
|
|
29
|
+
"main_argument": {"type": "string"},
|
|
30
|
+
"key_points": {"type": "array", "items": {"type": "string"}},
|
|
31
|
+
"external_sources": {"type": "array", "items": {"type": "string"}},
|
|
32
|
+
},
|
|
33
|
+
"required": ["title", "summary", "main_argument"],
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass(frozen=True)
|
|
38
|
+
class ProviderResult:
|
|
39
|
+
content: str | dict[str, Any]
|
|
40
|
+
resolved_url: str | None
|
|
41
|
+
title: str | None
|
|
42
|
+
description: str | None
|
|
43
|
+
content_type: str | None
|
|
44
|
+
source_http_status: int | None
|
|
45
|
+
provider_http_status: int
|
|
46
|
+
credits_used: int | None
|
|
47
|
+
elapsed_ms: int
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class ExtractionProvider(Protocol):
|
|
51
|
+
def extract(self, url: str, mode: str, timeout_seconds: int) -> ProviderResult: ...
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class FirecrawlKeylessProvider:
|
|
55
|
+
name = "firecrawl-keyless"
|
|
56
|
+
access = "experimental"
|
|
57
|
+
|
|
58
|
+
def extract(self, url: str, mode: str, timeout_seconds: int) -> ProviderResult:
|
|
59
|
+
formats: list[Any]
|
|
60
|
+
if mode == "markdown":
|
|
61
|
+
formats = ["markdown"]
|
|
62
|
+
else:
|
|
63
|
+
formats = [{"type": "json", "schema": STRUCTURED_SCHEMA}]
|
|
64
|
+
payload = {
|
|
65
|
+
"url": url,
|
|
66
|
+
"formats": formats,
|
|
67
|
+
"onlyMainContent": True,
|
|
68
|
+
"removeBase64Images": True,
|
|
69
|
+
"timeout": timeout_seconds * 1000,
|
|
70
|
+
}
|
|
71
|
+
body = json.dumps(payload, ensure_ascii=True).encode("utf-8")
|
|
72
|
+
request = urllib.request.Request(
|
|
73
|
+
FIRECRAWL_ENDPOINT,
|
|
74
|
+
data=body,
|
|
75
|
+
headers={
|
|
76
|
+
"Content-Type": "application/json",
|
|
77
|
+
"User-Agent": "public-source-extractor/0.1.0-alpha.1",
|
|
78
|
+
},
|
|
79
|
+
method="POST",
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
started = time.monotonic()
|
|
83
|
+
try:
|
|
84
|
+
with urllib.request.urlopen(request, timeout=timeout_seconds + 5) as response:
|
|
85
|
+
status = response.status
|
|
86
|
+
raw = response.read(MAX_RESPONSE_BYTES + 1)
|
|
87
|
+
except urllib.error.HTTPError as exc:
|
|
88
|
+
if exc.code == 429:
|
|
89
|
+
raise ProviderRateLimited() from exc
|
|
90
|
+
raise ProviderFailure() from exc
|
|
91
|
+
except (urllib.error.URLError, TimeoutError, socket.timeout) as exc:
|
|
92
|
+
reason = getattr(exc, "reason", None)
|
|
93
|
+
if isinstance(exc, (TimeoutError, socket.timeout)) or isinstance(
|
|
94
|
+
reason, (TimeoutError, socket.timeout)
|
|
95
|
+
):
|
|
96
|
+
raise ProviderTimeout() from exc
|
|
97
|
+
raise ProviderFailure() from exc
|
|
98
|
+
|
|
99
|
+
elapsed_ms = round((time.monotonic() - started) * 1000)
|
|
100
|
+
if len(raw) > MAX_RESPONSE_BYTES:
|
|
101
|
+
raise InvalidProviderResponse()
|
|
102
|
+
try:
|
|
103
|
+
document = json.loads(raw.decode("utf-8"))
|
|
104
|
+
except (UnicodeDecodeError, json.JSONDecodeError) as exc:
|
|
105
|
+
raise InvalidProviderResponse() from exc
|
|
106
|
+
if status != 200 or not isinstance(document, dict) or document.get("success") is not True:
|
|
107
|
+
raise ProviderFailure()
|
|
108
|
+
|
|
109
|
+
data = document.get("data")
|
|
110
|
+
if not isinstance(data, dict):
|
|
111
|
+
raise InvalidProviderResponse()
|
|
112
|
+
metadata = data.get("metadata")
|
|
113
|
+
if metadata is None:
|
|
114
|
+
metadata = {}
|
|
115
|
+
if not isinstance(metadata, dict):
|
|
116
|
+
raise InvalidProviderResponse()
|
|
117
|
+
|
|
118
|
+
try:
|
|
119
|
+
resolved_url = validate_provider_resolved_url(
|
|
120
|
+
metadata.get("sourceURL") or metadata.get("url")
|
|
121
|
+
)
|
|
122
|
+
except InputRejected as exc:
|
|
123
|
+
raise InvalidProviderResponse() from exc
|
|
124
|
+
content = data.get("markdown") if mode == "markdown" else data.get("json")
|
|
125
|
+
if mode == "markdown" and not isinstance(content, str):
|
|
126
|
+
raise InvalidProviderResponse()
|
|
127
|
+
if mode == "json" and not isinstance(content, dict):
|
|
128
|
+
raise InvalidProviderResponse()
|
|
129
|
+
|
|
130
|
+
source_status = metadata.get("statusCode")
|
|
131
|
+
if not isinstance(source_status, int) or isinstance(source_status, bool):
|
|
132
|
+
source_status = None
|
|
133
|
+
credits_used = metadata.get("creditsUsed")
|
|
134
|
+
if not isinstance(credits_used, int) or isinstance(credits_used, bool):
|
|
135
|
+
credits_used = None
|
|
136
|
+
|
|
137
|
+
return ProviderResult(
|
|
138
|
+
content=content,
|
|
139
|
+
resolved_url=resolved_url,
|
|
140
|
+
title=_optional_string(metadata.get("title") or metadata.get("og:title")),
|
|
141
|
+
description=_optional_string(
|
|
142
|
+
metadata.get("description") or metadata.get("og:description")
|
|
143
|
+
),
|
|
144
|
+
content_type=_optional_string(metadata.get("contentType")),
|
|
145
|
+
source_http_status=source_status,
|
|
146
|
+
provider_http_status=status,
|
|
147
|
+
credits_used=credits_used,
|
|
148
|
+
elapsed_ms=elapsed_ms,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def _optional_string(value: object) -> str | None:
|
|
153
|
+
return value if isinstance(value, str) else None
|
|
File without changes
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/Ishikawa-Hidekazu/public-source-extractor/blob/main/schemas/output-v0.1.schema.json",
|
|
4
|
+
"title": "Public Source Extractor Output v0.1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schema_version", "ok"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schema_version": {"const": "0.1"},
|
|
10
|
+
"ok": {"type": "boolean"},
|
|
11
|
+
"source": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"additionalProperties": false,
|
|
14
|
+
"required": ["requested_url", "resolved_url", "fetched_at"],
|
|
15
|
+
"properties": {
|
|
16
|
+
"requested_url": {"type": "string", "format": "uri"},
|
|
17
|
+
"resolved_url": {"type": ["string", "null"], "format": "uri"},
|
|
18
|
+
"fetched_at": {"type": "string", "format": "date-time"}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"mode": {"enum": ["markdown", "json"]},
|
|
22
|
+
"content": {"oneOf": [{"type": "string"}, {"type": "object"}]},
|
|
23
|
+
"metadata": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"required": ["title", "description", "content_type", "source_http_status"],
|
|
27
|
+
"properties": {
|
|
28
|
+
"title": {"type": ["string", "null"]},
|
|
29
|
+
"description": {"type": ["string", "null"]},
|
|
30
|
+
"content_type": {"type": ["string", "null"]},
|
|
31
|
+
"source_http_status": {"type": ["integer", "null"], "minimum": 100, "maximum": 599}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"provider": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"additionalProperties": false,
|
|
37
|
+
"required": ["name", "access", "http_status", "credits_used", "elapsed_ms"],
|
|
38
|
+
"properties": {
|
|
39
|
+
"name": {"type": "string", "const": "firecrawl-keyless", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"},
|
|
40
|
+
"access": {"const": "experimental"},
|
|
41
|
+
"http_status": {"type": "integer", "minimum": 100, "maximum": 599},
|
|
42
|
+
"credits_used": {"type": ["integer", "null"], "minimum": 0},
|
|
43
|
+
"elapsed_ms": {"type": "integer", "minimum": 0}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"warnings": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"required": ["code", "message"],
|
|
52
|
+
"properties": {
|
|
53
|
+
"code": {"type": "string", "pattern": "^[a-z0-9_]+$"},
|
|
54
|
+
"message": {"type": "string"}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"error": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"additionalProperties": false,
|
|
61
|
+
"required": ["code", "message", "retryable"],
|
|
62
|
+
"properties": {
|
|
63
|
+
"code": {"type": "string", "pattern": "^[a-z0-9_]+$"},
|
|
64
|
+
"message": {"type": "string"},
|
|
65
|
+
"retryable": {"type": "boolean"}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"allOf": [
|
|
70
|
+
{
|
|
71
|
+
"if": {"properties": {"ok": {"const": true}}, "required": ["ok"]},
|
|
72
|
+
"then": {
|
|
73
|
+
"required": ["source", "mode", "content", "metadata", "provider", "warnings"],
|
|
74
|
+
"not": {"required": ["error"]}
|
|
75
|
+
},
|
|
76
|
+
"else": {
|
|
77
|
+
"required": ["error"],
|
|
78
|
+
"not": {"anyOf": [{"required": ["content"]}, {"required": ["provider"]}]}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"if": {"properties": {"ok": {"const": true}, "mode": {"const": "markdown"}}, "required": ["ok", "mode"]},
|
|
83
|
+
"then": {"properties": {"content": {"type": "string"}}}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"if": {"properties": {"ok": {"const": true}, "mode": {"const": "json"}}, "required": ["ok", "mode"]},
|
|
87
|
+
"then": {"properties": {"content": {"type": "object"}}}
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import ipaddress
|
|
4
|
+
import re
|
|
5
|
+
import urllib.parse
|
|
6
|
+
|
|
7
|
+
from .errors import InputRejected
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
BLOCKED_HOSTS = {
|
|
11
|
+
"accounts.google.com",
|
|
12
|
+
"calendar.google.com",
|
|
13
|
+
"docs.google.com",
|
|
14
|
+
"drive.google.com",
|
|
15
|
+
"mail.google.com",
|
|
16
|
+
"search.google.com",
|
|
17
|
+
"twitter.com",
|
|
18
|
+
"x.com",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
LOCAL_SUFFIXES = (".local", ".localhost", ".internal", ".home", ".lan")
|
|
22
|
+
|
|
23
|
+
BLOCKED_PATH_RE = re.compile(
|
|
24
|
+
r"(^|/)(wp-admin|wp-login\.php|admin|login|logout|oauth|callback)(/|$)",
|
|
25
|
+
re.IGNORECASE,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
DENIED_QUERY_NAMES = {
|
|
29
|
+
"access_key",
|
|
30
|
+
"access_token",
|
|
31
|
+
"api_key",
|
|
32
|
+
"apikey",
|
|
33
|
+
"auth",
|
|
34
|
+
"authorization",
|
|
35
|
+
"code",
|
|
36
|
+
"cookie",
|
|
37
|
+
"credential",
|
|
38
|
+
"credentials",
|
|
39
|
+
"key",
|
|
40
|
+
"passwd",
|
|
41
|
+
"password",
|
|
42
|
+
"refresh_token",
|
|
43
|
+
"secret",
|
|
44
|
+
"session",
|
|
45
|
+
"sessionid",
|
|
46
|
+
"token",
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
DENIED_QUERY_SEGMENTS = {
|
|
50
|
+
"auth",
|
|
51
|
+
"authorization",
|
|
52
|
+
"cookie",
|
|
53
|
+
"credential",
|
|
54
|
+
"credentials",
|
|
55
|
+
"key",
|
|
56
|
+
"passwd",
|
|
57
|
+
"password",
|
|
58
|
+
"secret",
|
|
59
|
+
"session",
|
|
60
|
+
"signature",
|
|
61
|
+
"token",
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _decode_repeated(value: str, rounds: int = 3) -> str:
|
|
66
|
+
decoded = value
|
|
67
|
+
for _ in range(rounds):
|
|
68
|
+
next_value = urllib.parse.unquote(decoded)
|
|
69
|
+
if next_value == decoded:
|
|
70
|
+
break
|
|
71
|
+
decoded = next_value
|
|
72
|
+
return decoded
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _query_name_is_sensitive(name: str) -> bool:
|
|
76
|
+
decoded = _decode_repeated(name).lower()
|
|
77
|
+
canonical = re.sub(r"[^a-z0-9]+", "_", decoded).strip("_")
|
|
78
|
+
if canonical in DENIED_QUERY_NAMES:
|
|
79
|
+
return True
|
|
80
|
+
segments = {segment for segment in canonical.split("_") if segment}
|
|
81
|
+
return bool(segments & DENIED_QUERY_SEGMENTS)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _validate_host(host: str) -> None:
|
|
85
|
+
if not host or any(ord(char) > 127 for char in host):
|
|
86
|
+
raise InputRejected()
|
|
87
|
+
if "%" in host or "\\" in host:
|
|
88
|
+
raise InputRejected()
|
|
89
|
+
|
|
90
|
+
normalized = host.lower().rstrip(".")
|
|
91
|
+
if normalized in {"localhost", "local"} or normalized.endswith(LOCAL_SUFFIXES):
|
|
92
|
+
raise InputRejected()
|
|
93
|
+
if normalized in BLOCKED_HOSTS or any(
|
|
94
|
+
normalized.endswith(f".{blocked}") for blocked in BLOCKED_HOSTS
|
|
95
|
+
):
|
|
96
|
+
raise InputRejected()
|
|
97
|
+
|
|
98
|
+
try:
|
|
99
|
+
ip = ipaddress.ip_address(normalized)
|
|
100
|
+
except ValueError:
|
|
101
|
+
ip = None
|
|
102
|
+
|
|
103
|
+
if ip is not None:
|
|
104
|
+
if not ip.is_global:
|
|
105
|
+
raise InputRejected()
|
|
106
|
+
return
|
|
107
|
+
|
|
108
|
+
# Reject legacy integer, octal, and hex IPv4 spellings instead of relying on resolver behavior.
|
|
109
|
+
if re.fullmatch(r"[0-9.]+", normalized) or normalized.startswith(("0x", "0X")):
|
|
110
|
+
raise InputRejected()
|
|
111
|
+
if not re.fullmatch(r"[a-z0-9](?:[a-z0-9.-]{0,251}[a-z0-9])?", normalized):
|
|
112
|
+
raise InputRejected()
|
|
113
|
+
if ".." in normalized or "." not in normalized:
|
|
114
|
+
raise InputRejected()
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def validate_public_url(raw_url: str) -> urllib.parse.ParseResult:
|
|
118
|
+
if not raw_url or any(char in raw_url for char in ("\r", "\n", "\x00")):
|
|
119
|
+
raise InputRejected()
|
|
120
|
+
|
|
121
|
+
parsed = urllib.parse.urlparse(raw_url)
|
|
122
|
+
if parsed.scheme not in {"http", "https"} or not parsed.netloc or not parsed.hostname:
|
|
123
|
+
raise InputRejected()
|
|
124
|
+
if parsed.username or parsed.password or parsed.fragment:
|
|
125
|
+
raise InputRejected()
|
|
126
|
+
|
|
127
|
+
try:
|
|
128
|
+
port = parsed.port
|
|
129
|
+
except ValueError as exc:
|
|
130
|
+
raise InputRejected() from exc
|
|
131
|
+
expected_port = 443 if parsed.scheme == "https" else 80
|
|
132
|
+
if port is not None and port != expected_port:
|
|
133
|
+
raise InputRejected()
|
|
134
|
+
|
|
135
|
+
raw_host = parsed.netloc.rsplit("@", 1)[-1]
|
|
136
|
+
if raw_host.startswith("["):
|
|
137
|
+
raw_host = raw_host[1 : raw_host.find("]")]
|
|
138
|
+
else:
|
|
139
|
+
raw_host = raw_host.rsplit(":", 1)[0] if ":" in raw_host else raw_host
|
|
140
|
+
if "%" in raw_host or any(ord(char) > 127 for char in raw_host):
|
|
141
|
+
raise InputRejected()
|
|
142
|
+
_validate_host(parsed.hostname)
|
|
143
|
+
|
|
144
|
+
decoded_path = _decode_repeated(parsed.path or "/").replace("\\", "/")
|
|
145
|
+
if BLOCKED_PATH_RE.search(decoded_path):
|
|
146
|
+
raise InputRejected()
|
|
147
|
+
|
|
148
|
+
try:
|
|
149
|
+
query_pairs = urllib.parse.parse_qsl(
|
|
150
|
+
parsed.query,
|
|
151
|
+
keep_blank_values=True,
|
|
152
|
+
strict_parsing=False,
|
|
153
|
+
max_num_fields=100,
|
|
154
|
+
)
|
|
155
|
+
except ValueError as exc:
|
|
156
|
+
raise InputRejected() from exc
|
|
157
|
+
for name, _value in query_pairs:
|
|
158
|
+
if _query_name_is_sensitive(name):
|
|
159
|
+
raise InputRejected()
|
|
160
|
+
|
|
161
|
+
return parsed
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def validate_provider_resolved_url(raw_url: object) -> str | None:
|
|
165
|
+
if raw_url is None:
|
|
166
|
+
return None
|
|
167
|
+
if not isinstance(raw_url, str):
|
|
168
|
+
raise InputRejected()
|
|
169
|
+
validate_public_url(raw_url)
|
|
170
|
+
return raw_url
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: public-source-extractor
|
|
3
|
+
Version: 0.1.0a2
|
|
4
|
+
Summary: Validate a public URL and convert it into reviewable AI-ready Markdown or JSON.
|
|
5
|
+
Author: Ishikawa Hidekazu
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://ishikawa.co/
|
|
8
|
+
Project-URL: Repository, https://github.com/Ishikawa-Hidekazu/public-source-extractor
|
|
9
|
+
Project-URL: Issues, https://github.com/Ishikawa-Hidekazu/public-source-extractor/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/Ishikawa-Hidekazu/public-source-extractor/blob/main/CHANGELOG.md
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: build>=1.2.2; extra == "dev"
|
|
21
|
+
Requires-Dist: jsonschema>=4.23; extra == "dev"
|
|
22
|
+
Requires-Dist: ruff<0.16,>=0.12; extra == "dev"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# Public Source Extractor
|
|
26
|
+
|
|
27
|
+
[](https://github.com/Ishikawa-Hidekazu/public-source-extractor/actions/workflows/ci.yml)
|
|
28
|
+
[](https://github.com/Ishikawa-Hidekazu/public-source-extractor/releases)
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
> [!IMPORTANT]
|
|
32
|
+
> 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.
|
|
33
|
+
|
|
34
|
+
`public-source-extractor` is a public-URL intake guardrail for AI research
|
|
35
|
+
workflows. It validates one public HTTP or HTTPS URL, sends that URL to the
|
|
36
|
+
experimental provider, and returns reviewable Markdown or a stable JSON
|
|
37
|
+
envelope.
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
[日本語README](README.ja.md)
|
|
42
|
+
|
|
43
|
+
## What it does
|
|
44
|
+
|
|
45
|
+
- Extracts one public page as Markdown.
|
|
46
|
+
- Produces structured JSON with a versioned JSON Schema.
|
|
47
|
+
- Rejects local, private, authenticated, admin, and secret-bearing URL patterns.
|
|
48
|
+
- Keeps results on stdout or writes a new local file with no-overwrite behavior.
|
|
49
|
+
- Returns stable JSON errors and documented exit codes.
|
|
50
|
+
|
|
51
|
+
It is not a crawler, browser automation tool, login helper, source-reliability judge, or private-page extractor.
|
|
52
|
+
|
|
53
|
+
### How this differs from the official Firecrawl CLI
|
|
54
|
+
|
|
55
|
+
The [official Firecrawl CLI](https://github.com/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.
|
|
56
|
+
|
|
57
|
+
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.
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
Public Source Extractor requires Python 3.11 or newer.
|
|
62
|
+
|
|
63
|
+
Run the published alpha without a permanent install:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
uvx public-source-extractor --version
|
|
67
|
+
uvx public-source-extractor https://example.com/
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This path requires `uv` and resolves the published PyPI prerelease. The second
|
|
71
|
+
command sends `https://example.com/` to Firecrawl Cloud; the version command
|
|
72
|
+
does not perform extraction.
|
|
73
|
+
|
|
74
|
+
Pin the exact package version when reproducibility matters:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
uvx public-source-extractor@0.1.0a2 --version
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Install the prerelease as an isolated command:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pipx install public-source-extractor==0.1.0a2
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or use pip in an existing Python environment:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
python3 -m pip install public-source-extractor==0.1.0a2
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The public Git tag remains an auditable fallback:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
uvx --from 'git+https://github.com/Ishikawa-Hidekazu/public-source-extractor.git@v0.1.0-alpha.2' public-source-extractor --version
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
PyPI publication uses GitHub Actions Trusted Publishing with short-lived OIDC
|
|
99
|
+
credentials. No long-lived PyPI API token is stored in this repository.
|
|
100
|
+
|
|
101
|
+
## Quick start
|
|
102
|
+
|
|
103
|
+
Markdown to stdout:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
public-source-extractor https://example.com/
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Markdown front matter includes `provider_credits_used` and
|
|
110
|
+
`provider_elapsed_ms`. The credits field is `null` when the experimental
|
|
111
|
+
provider does not report it; elapsed time is measured by the CLI in
|
|
112
|
+
milliseconds. These are metadata-only values. Raw provider responses and
|
|
113
|
+
request identifiers are not exposed.
|
|
114
|
+
|
|
115
|
+
JSON to stdout:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
public-source-extractor https://example.com/ --mode json --pretty
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Write a new file:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
public-source-extractor https://example.com/ --output report.md
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The output path must have an existing non-symlink parent and must not already exist.
|
|
128
|
+
|
|
129
|
+
<picture>
|
|
130
|
+
<source media="(max-width: 600px)" srcset="assets/source/terminal-example-mobile.svg">
|
|
131
|
+
<img src="assets/source/terminal-example.svg" alt="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.">
|
|
132
|
+
</picture>
|
|
133
|
+
|
|
134
|
+
[View the public-safe examples](examples/) ·
|
|
135
|
+
[View the reproducible visual sources](assets/source/README.md)
|
|
136
|
+
|
|
137
|
+
## Real-world use
|
|
138
|
+
|
|
139
|
+
[This Japanese implementation log](https://taupe.site/entry/public-source-extractor-ai-research-cli/) 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.
|
|
140
|
+
|
|
141
|
+
## CLI contract
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
public-source-extractor <url> [--mode markdown|json]
|
|
145
|
+
[--output <new-path>]
|
|
146
|
+
[--timeout 1..120]
|
|
147
|
+
[--provider firecrawl-keyless]
|
|
148
|
+
[--pretty]
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
| Exit | Meaning |
|
|
152
|
+
|---:|---|
|
|
153
|
+
| `0` | Success |
|
|
154
|
+
| `2` | Usage error or rejected URL |
|
|
155
|
+
| `3` | Provider, network, rate-limit, or timeout failure |
|
|
156
|
+
| `4` | Invalid, incomplete, or unsafe provider response |
|
|
157
|
+
| `5` | Output path or write failure |
|
|
158
|
+
|
|
159
|
+
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.
|
|
160
|
+
|
|
161
|
+
### Recovering from `provider_rate_limited`
|
|
162
|
+
|
|
163
|
+
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.
|
|
164
|
+
|
|
165
|
+
When stderr reports `provider_rate_limited` with `retryable: true`:
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{"schema_version":"0.1","ok":false,"error":{"code":"provider_rate_limited","message":"The experimental provider rate limit was exceeded.","retryable":true}}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
The process exits with code `3` and stdout remains empty.
|
|
172
|
+
|
|
173
|
+
1. Stop the current burst instead of retrying repeatedly.
|
|
174
|
+
2. Wait and retry later. This CLI does not promise an exact delay when no retry timing is safely exposed.
|
|
175
|
+
3. Reduce request volume and process only selected public sources.
|
|
176
|
+
4. Use the original public page directly when extraction is not required.
|
|
177
|
+
|
|
178
|
+
The CLI does not automatically retry, switch providers, discover credentials, or expose raw provider bodies. See [Issue #9](https://github.com/Ishikawa-Hidekazu/public-source-extractor/issues/9) for the observed condition and documentation scope.
|
|
179
|
+
|
|
180
|
+
## Safety boundary
|
|
181
|
+
|
|
182
|
+
Before sending a URL, the CLI rejects:
|
|
183
|
+
|
|
184
|
+
- schemes other than HTTP or HTTPS;
|
|
185
|
+
- URL user information and fragments;
|
|
186
|
+
- localhost, local suffixes, and non-global literal IP addresses;
|
|
187
|
+
- ambiguous integer, octal, and hexadecimal IPv4 forms;
|
|
188
|
+
- Unicode or percent-encoded hostnames and IPv6 zone identifiers;
|
|
189
|
+
- non-default ports;
|
|
190
|
+
- login, admin, OAuth, and callback paths, including encoded forms;
|
|
191
|
+
- query parameter names that indicate tokens, secrets, passwords, credentials, signatures, sessions, cookies, authorization, or keys.
|
|
192
|
+
|
|
193
|
+
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.
|
|
194
|
+
|
|
195
|
+
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.
|
|
196
|
+
|
|
197
|
+
Firecrawl Cloud receives the requested URL and processes the page. Review [Firecrawl's terms](https://www.firecrawl.dev/terms-of-service), the target site's terms, robots policy, copyright, and privacy requirements before use.
|
|
198
|
+
|
|
199
|
+
## JSON Schema and examples
|
|
200
|
+
|
|
201
|
+
- [Output Schema v0.1](schemas/output-v0.1.schema.json)
|
|
202
|
+
- [Public-safe Markdown example](examples/example-report.md)
|
|
203
|
+
- [Public-safe JSON example](examples/example-report.json)
|
|
204
|
+
|
|
205
|
+
Structured JSON extraction is inferred output, not source truth. Validate important claims against the original page.
|
|
206
|
+
|
|
207
|
+
## Development
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
python3 -m venv .venv
|
|
211
|
+
.venv/bin/python -m pip install -e '.[dev]'
|
|
212
|
+
PYTHONPATH=src .venv/bin/python -m unittest discover -s tests -v
|
|
213
|
+
.venv/bin/ruff check src tests
|
|
214
|
+
.venv/bin/python -m build
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
The explicit `PYTHONPATH=src` also works before an editable install. Network smoke tests remain separate from the offline suite.
|
|
218
|
+
|
|
219
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md), [SECURITY.md](SECURITY.md), and [SUPPORT.md](SUPPORT.md).
|
|
220
|
+
|
|
221
|
+
## Status
|
|
222
|
+
|
|
223
|
+
Alpha package. Package version `0.1.0a2` maps to tag `v0.1.0-alpha.2`.
|
|
224
|
+
The package is distributed through PyPI and the matching public Git tag.
|
|
225
|
+
`firecrawl-keyless` is an experimental third-party provider, and no
|
|
226
|
+
compatibility or service-availability guarantee is made.
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
public_source_extractor/__init__.py,sha256=DXZn-eFYumzPbGxLy9c1IKRjV74ha9D9R-hiGbsY6lo,64
|
|
2
|
+
public_source_extractor/__main__.py,sha256=4BTAfHHF2u3j_oUg_Wluqu0HyxnXfAHBQUcnPQ-e1xs,50
|
|
3
|
+
public_source_extractor/cli.py,sha256=83rLUPa5UwP4WmO-lBeaPPNxGriYAOyJZQLsI6dP88E,2265
|
|
4
|
+
public_source_extractor/errors.py,sha256=CM1hD09Z6LpuW-9tAltt_LOUN3y-ulteNorzNhcZTHc,1594
|
|
5
|
+
public_source_extractor/output.py,sha256=WfouveBMseAzvUtZRgYA9HFhgjQDGqNQXbaNZ6jSidI,4201
|
|
6
|
+
public_source_extractor/provider.py,sha256=vkxAQnJF8qYVP7ry8D--hBtQqwS6rVl8Bu-yPjKfwlg,5348
|
|
7
|
+
public_source_extractor/url_policy.py,sha256=ypmyDR_BmOC1iF1CppaoFgH1lGmmY9DzwGoxKOoV1nU,4574
|
|
8
|
+
public_source_extractor/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
public_source_extractor/schemas/output-v0.1.schema.json,sha256=g_jI026fIlkEv9xbwlOtL05-9rCTz1rAeu1GmIYRJ7I,3288
|
|
10
|
+
public_source_extractor-0.1.0a2.dist-info/licenses/LICENSE,sha256=GIuyYJ3MmxBeSj1qQof3BPeEmm_vrdY74hNw621LX_g,1075
|
|
11
|
+
public_source_extractor-0.1.0a2.dist-info/METADATA,sha256=GY8AJd-oVWA2mdI1cq1RhcyI3lKuG8O0_arhOBG6PTQ,10174
|
|
12
|
+
public_source_extractor-0.1.0a2.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
13
|
+
public_source_extractor-0.1.0a2.dist-info/entry_points.txt,sha256=gFp0UdMNcmUWP3Kn4oAshglkyKskYJbXec6rWxp8RMc,77
|
|
14
|
+
public_source_extractor-0.1.0a2.dist-info/top_level.txt,sha256=xeq1Zecr5hCHGHjWY3sGm4m07RYbwtNvHuQstpaR6TM,24
|
|
15
|
+
public_source_extractor-0.1.0a2.dist-info/RECORD,,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ishikawa Hidekazu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
public_source_extractor
|