clearfetch 1.0.0__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.
clearfetch/__init__.py ADDED
@@ -0,0 +1,20 @@
1
+ from clearfetch.client import ClearFetch, AsyncClearFetch, ClearFetchError
2
+ from clearfetch.types import ReadResult, ExtractResult, SearchResult, SearchItem, UsageResult, Metadata
3
+ from clearfetch.integrations.langchain import ClearFetchLoader
4
+ from clearfetch.integrations.llamaindex import ClearFetchReader
5
+
6
+ __version__ = "1.0.0"
7
+
8
+ __all__ = [
9
+ "ClearFetch",
10
+ "AsyncClearFetch",
11
+ "ClearFetchError",
12
+ "ReadResult",
13
+ "ExtractResult",
14
+ "SearchResult",
15
+ "SearchItem",
16
+ "UsageResult",
17
+ "Metadata",
18
+ "ClearFetchLoader",
19
+ "ClearFetchReader",
20
+ ]
clearfetch/cli.py ADDED
@@ -0,0 +1,77 @@
1
+ import sys
2
+ import json
3
+ import argparse
4
+ from clearfetch.client import ClearFetch, ClearFetchError
5
+
6
+ def main():
7
+ parser = argparse.ArgumentParser(
8
+ prog="clearfetch",
9
+ description="ClearFetch CLI — Unblocked Web & Anti-Bot Extraction Layer for AI Agents"
10
+ )
11
+ parser.add_argument("--api-key", help="ClearFetch API key (or set CLEARFETCH_API_KEY env var)")
12
+ parser.add_argument("--api-url", help="ClearFetch Gateway base URL")
13
+
14
+ subparsers = parser.add_subparsers(dest="command", required=True)
15
+
16
+ # Read command
17
+ read_parser = subparsers.add_parser("read", help="Read any webpage as clean Markdown")
18
+ read_parser.add_argument("url", help="Target URL to scrape")
19
+ read_parser.add_argument("--stealth", choices=["auto", "force"], default="auto", help="Anti-bot bypass mode")
20
+ read_parser.add_argument("--max-age", type=int, default=3600, help="Cache TTL in seconds")
21
+
22
+ # Extract command
23
+ extract_parser = subparsers.add_parser("extract", help="Extract typed JSON using an LLM")
24
+ extract_parser.add_argument("url", help="Target URL")
25
+ extract_parser.add_argument("--schema", required=True, help="Path to JSON Schema file")
26
+ extract_parser.add_argument("--prompt", help="Optional instruction prompt")
27
+
28
+ # Search command
29
+ search_parser = subparsers.add_parser("search", help="Search the live web and bundle Markdown")
30
+ search_parser.add_argument("query", help="Search query string")
31
+ search_parser.add_argument("--limit", type=int, default=5, help="Number of results (1-10)")
32
+
33
+ # Usage command
34
+ subparsers.add_parser("usage", help="Check remaining credits and plan details")
35
+
36
+ args = parser.parse_args()
37
+
38
+ try:
39
+ client = ClearFetch(api_key=args.api_key, base_url=args.api_url)
40
+
41
+ if args.command == "read":
42
+ result = client.read(url=args.url, stealth=args.stealth, max_age=args.max_age)
43
+ print(f"# {result.title}\n\n{result.markdown}\n")
44
+ print(f"\n--- Metadata: status={result.metadata.status_code}, tokens={result.metadata.estimated_tokens}, latency={result.metadata.latency_ms}ms, credits={result.metadata.credits_used} ---", file=sys.stderr)
45
+
46
+ elif args.command == "extract":
47
+ with open(args.schema, "r", encoding="utf-8") as f:
48
+ schema_data = json.load(f)
49
+ result = client.extract(url=args.url, json_schema=schema_data, prompt=args.prompt)
50
+ print(json.dumps(result.data, indent=2))
51
+
52
+ elif args.command == "search":
53
+ result = client.search(query=args.query, limit=args.limit)
54
+ for idx, item in enumerate(result.results, 1):
55
+ print(f"[{idx}] {item.title} ({item.url})\n")
56
+ if item.markdown:
57
+ print(f"{item.markdown[:500]}...\n")
58
+ else:
59
+ print(f"{item.snippet}\n")
60
+ print("-" * 50)
61
+
62
+ elif args.command == "usage":
63
+ result = client.get_usage()
64
+ print(f"Plan Tier: {result.plan_tier}")
65
+ print(f"Credits Remaining: {result.credits_balance:,}")
66
+ print(f"Concurrency Limit: {result.concurrency_limit} threads")
67
+ print(f"Rate Limit: {result.rate_limit_per_min} req/min")
68
+
69
+ except ClearFetchError as e:
70
+ print(f"ClearFetch API Error: {e}", file=sys.stderr)
71
+ sys.exit(1)
72
+ except Exception as e:
73
+ print(f"Error: {e}", file=sys.stderr)
74
+ sys.exit(1)
75
+
76
+ if __name__ == "__main__":
77
+ main()
clearfetch/client.py ADDED
@@ -0,0 +1,306 @@
1
+ import os
2
+ import httpx
3
+ from typing import Dict, Any, Optional, List
4
+ from clearfetch.types import ReadResult, ExtractResult, SearchResult, SearchItem, UsageResult, Metadata
5
+
6
+ class ClearFetchError(Exception):
7
+ """Base exception for ClearFetch API errors."""
8
+ def __init__(self, message: str, status_code: Optional[int] = None, details: Optional[Any] = None):
9
+ super().__init__(message)
10
+ self.status_code = status_code
11
+ self.details = details
12
+
13
+ class ClearFetch:
14
+ """Synchronous ClearFetch API Client."""
15
+ def __init__(
16
+ self,
17
+ api_key: Optional[str] = None,
18
+ base_url: Optional[str] = None,
19
+ timeout: float = 60.0
20
+ ):
21
+ self.api_key = api_key or os.getenv("CLEARFETCH_API_KEY", "")
22
+ self.base_url = (base_url or os.getenv("CLEARFETCH_API_URL", "https://api.clearfetch.dev")).rstrip("/")
23
+ self.timeout = timeout
24
+
25
+ if not self.api_key:
26
+ raise ValueError(
27
+ "ClearFetch API key must be provided either via the 'api_key' argument or the 'CLEARFETCH_API_KEY' environment variable."
28
+ )
29
+
30
+ self._headers = {
31
+ "Authorization": f"Bearer {self.api_key}",
32
+ "Content-Type": "application/json",
33
+ "User-Agent": "ClearFetch-Python-SDK/1.0.0"
34
+ }
35
+
36
+ def _handle_response(self, response: httpx.Response) -> Dict[str, Any]:
37
+ if not response.is_success:
38
+ detail = response.text
39
+ try:
40
+ err_data = response.json()
41
+ detail = err_data.get("detail", response.text)
42
+ except Exception:
43
+ pass
44
+ raise ClearFetchError(
45
+ f"ClearFetch API returned {response.status_code}: {detail}",
46
+ status_code=response.status_code,
47
+ details=detail
48
+ )
49
+ return response.json()
50
+
51
+ def read(
52
+ self,
53
+ url: str,
54
+ stealth: str = "auto",
55
+ max_age: int = 3600,
56
+ only_main_content: bool = True,
57
+ include_links: bool = True
58
+ ) -> ReadResult:
59
+ """Reads any URL as clean Markdown, bypassing Cloudflare Turnstile & DataDome."""
60
+ with httpx.Client(timeout=self.timeout) as client:
61
+ resp = client.post(
62
+ f"{self.base_url}/v1/read",
63
+ headers=self._headers,
64
+ json={
65
+ "url": url,
66
+ "stealth": stealth,
67
+ "max_age": max_age,
68
+ "only_main_content": only_main_content,
69
+ "include_links": include_links
70
+ }
71
+ )
72
+ data = self._handle_response(resp)
73
+ meta = data["metadata"]
74
+ return ReadResult(
75
+ success=data["success"],
76
+ url=data["url"],
77
+ title=data["title"],
78
+ description=data["description"],
79
+ markdown=data["markdown"],
80
+ links=data["links"],
81
+ metadata=Metadata(**meta)
82
+ )
83
+
84
+ def extract(
85
+ self,
86
+ url: str,
87
+ json_schema: Dict[str, Any],
88
+ prompt: Optional[str] = None,
89
+ stealth: str = "auto"
90
+ ) -> ExtractResult:
91
+ """Extracts strongly-typed structured JSON conforming to a JSON Schema."""
92
+ with httpx.Client(timeout=self.timeout) as client:
93
+ resp = client.post(
94
+ f"{self.base_url}/v1/extract",
95
+ headers=self._headers,
96
+ json={
97
+ "url": url,
98
+ "json_schema": json_schema,
99
+ "prompt": prompt,
100
+ "stealth": stealth
101
+ }
102
+ )
103
+ data = self._handle_response(resp)
104
+ meta = data["metadata"]
105
+ return ExtractResult(
106
+ success=data["success"],
107
+ url=data["url"],
108
+ data=data["data"],
109
+ metadata=Metadata(**meta)
110
+ )
111
+
112
+ def search(
113
+ self,
114
+ query: str,
115
+ limit: int = 5,
116
+ scrape_results: bool = True
117
+ ) -> SearchResult:
118
+ """Searches the web and bundles clean Markdown of top results for RAG."""
119
+ with httpx.Client(timeout=self.timeout) as client:
120
+ resp = client.post(
121
+ f"{self.base_url}/v1/search",
122
+ headers=self._headers,
123
+ json={
124
+ "query": query,
125
+ "limit": limit,
126
+ "scrape_results": scrape_results
127
+ }
128
+ )
129
+ data = self._handle_response(resp)
130
+ items = [
131
+ SearchItem(
132
+ title=item["title"],
133
+ url=item["url"],
134
+ snippet=item["snippet"],
135
+ markdown=item.get("markdown"),
136
+ estimated_tokens=item.get("estimated_tokens")
137
+ )
138
+ for item in data["results"]
139
+ ]
140
+ return SearchResult(
141
+ success=data["success"],
142
+ query=data["query"],
143
+ count=data["count"],
144
+ results=items,
145
+ total_estimated_tokens=data["total_estimated_tokens"],
146
+ credits_used=data["credits_used"]
147
+ )
148
+
149
+ def get_usage(self) -> UsageResult:
150
+ """Retrieves account balance and recent telemetry logs."""
151
+ with httpx.Client(timeout=self.timeout) as client:
152
+ resp = client.get(f"{self.base_url}/v1/usage", headers=self._headers)
153
+ data = self._handle_response(resp)
154
+ return UsageResult(
155
+ credits_balance=data["credits_balance"],
156
+ plan_tier=data["plan_tier"],
157
+ concurrency_limit=data["concurrency_limit"],
158
+ rate_limit_per_min=data["rate_limit_per_min"],
159
+ recent_logs=data.get("recent_logs", [])
160
+ )
161
+
162
+
163
+ class AsyncClearFetch:
164
+ """Asynchronous ClearFetch API Client."""
165
+ def __init__(
166
+ self,
167
+ api_key: Optional[str] = None,
168
+ base_url: Optional[str] = None,
169
+ timeout: float = 60.0
170
+ ):
171
+ self.api_key = api_key or os.getenv("CLEARFETCH_API_KEY", "")
172
+ self.base_url = (base_url or os.getenv("CLEARFETCH_API_URL", "https://api.clearfetch.dev")).rstrip("/")
173
+ self.timeout = timeout
174
+
175
+ if not self.api_key:
176
+ raise ValueError(
177
+ "ClearFetch API key must be provided either via the 'api_key' argument or the 'CLEARFETCH_API_KEY' environment variable."
178
+ )
179
+
180
+ self._headers = {
181
+ "Authorization": f"Bearer {self.api_key}",
182
+ "Content-Type": "application/json",
183
+ "User-Agent": "ClearFetch-Python-AsyncSDK/1.0.0"
184
+ }
185
+
186
+ def _handle_response(self, response: httpx.Response) -> Dict[str, Any]:
187
+ if not response.is_success:
188
+ detail = response.text
189
+ try:
190
+ err_data = response.json()
191
+ detail = err_data.get("detail", response.text)
192
+ except Exception:
193
+ pass
194
+ raise ClearFetchError(
195
+ f"ClearFetch API returned {response.status_code}: {detail}",
196
+ status_code=response.status_code,
197
+ details=detail
198
+ )
199
+ return response.json()
200
+
201
+ async def read(
202
+ self,
203
+ url: str,
204
+ stealth: str = "auto",
205
+ max_age: int = 3600,
206
+ only_main_content: bool = True,
207
+ include_links: bool = True
208
+ ) -> ReadResult:
209
+ async with httpx.AsyncClient(timeout=self.timeout) as client:
210
+ resp = await client.post(
211
+ f"{self.base_url}/v1/read",
212
+ headers=self._headers,
213
+ json={
214
+ "url": url,
215
+ "stealth": stealth,
216
+ "max_age": max_age,
217
+ "only_main_content": only_main_content,
218
+ "include_links": include_links
219
+ }
220
+ )
221
+ data = self._handle_response(resp)
222
+ meta = data["metadata"]
223
+ return ReadResult(
224
+ success=data["success"],
225
+ url=data["url"],
226
+ title=data["title"],
227
+ description=data["description"],
228
+ markdown=data["markdown"],
229
+ links=data["links"],
230
+ metadata=Metadata(**meta)
231
+ )
232
+
233
+ async def extract(
234
+ self,
235
+ url: str,
236
+ json_schema: Dict[str, Any],
237
+ prompt: Optional[str] = None,
238
+ stealth: str = "auto"
239
+ ) -> ExtractResult:
240
+ async with httpx.AsyncClient(timeout=self.timeout) as client:
241
+ resp = await client.post(
242
+ f"{self.base_url}/v1/extract",
243
+ headers=self._headers,
244
+ json={
245
+ "url": url,
246
+ "json_schema": json_schema,
247
+ "prompt": prompt,
248
+ "stealth": stealth
249
+ }
250
+ )
251
+ data = self._handle_response(resp)
252
+ meta = data["metadata"]
253
+ return ExtractResult(
254
+ success=data["success"],
255
+ url=data["url"],
256
+ data=data["data"],
257
+ metadata=Metadata(**meta)
258
+ )
259
+
260
+ async def search(
261
+ self,
262
+ query: str,
263
+ limit: int = 5,
264
+ scrape_results: bool = True
265
+ ) -> SearchResult:
266
+ async with httpx.AsyncClient(timeout=self.timeout) as client:
267
+ resp = await client.post(
268
+ f"{self.base_url}/v1/search",
269
+ headers=self._headers,
270
+ json={
271
+ "query": query,
272
+ "limit": limit,
273
+ "scrape_results": scrape_results
274
+ }
275
+ )
276
+ data = self._handle_response(resp)
277
+ items = [
278
+ SearchItem(
279
+ title=item["title"],
280
+ url=item["url"],
281
+ snippet=item["snippet"],
282
+ markdown=item.get("markdown"),
283
+ estimated_tokens=item.get("estimated_tokens")
284
+ )
285
+ for item in data["results"]
286
+ ]
287
+ return SearchResult(
288
+ success=data["success"],
289
+ query=data["query"],
290
+ count=data["count"],
291
+ results=items,
292
+ total_estimated_tokens=data["total_estimated_tokens"],
293
+ credits_used=data["credits_used"]
294
+ )
295
+
296
+ async def get_usage(self) -> UsageResult:
297
+ async with httpx.AsyncClient(timeout=self.timeout) as client:
298
+ resp = await client.get(f"{self.base_url}/v1/usage", headers=self._headers)
299
+ data = self._handle_response(resp)
300
+ return UsageResult(
301
+ credits_balance=data["credits_balance"],
302
+ plan_tier=data["plan_tier"],
303
+ concurrency_limit=data["concurrency_limit"],
304
+ rate_limit_per_min=data["rate_limit_per_min"],
305
+ recent_logs=data.get("recent_logs", [])
306
+ )
@@ -0,0 +1,4 @@
1
+ from clearfetch.integrations.langchain import ClearFetchLoader
2
+ from clearfetch.integrations.llamaindex import ClearFetchReader
3
+
4
+ __all__ = ["ClearFetchLoader", "ClearFetchReader"]
@@ -0,0 +1,47 @@
1
+ from typing import List, Optional, Any, Iterator
2
+ from clearfetch.client import ClearFetch
3
+
4
+ class ClearFetchLoader:
5
+ """LangChain Document Loader for ClearFetch unblocked web extraction."""
6
+ def __init__(
7
+ self,
8
+ urls: List[str],
9
+ api_key: Optional[str] = None,
10
+ stealth: str = "auto",
11
+ only_main_content: bool = True
12
+ ):
13
+ self.urls = urls if isinstance(urls, list) else [urls]
14
+ self.client = ClearFetch(api_key=api_key)
15
+ self.stealth = stealth
16
+ self.only_main_content = only_main_content
17
+
18
+ def lazy_load(self) -> Iterator[Any]:
19
+ try:
20
+ from langchain_core.documents import Document
21
+ except ImportError:
22
+ # Fallback mock Document class if langchain_core is not installed
23
+ from dataclasses import dataclass
24
+ @dataclass
25
+ class Document:
26
+ page_content: str
27
+ metadata: dict
28
+
29
+ for url in self.urls:
30
+ res = self.client.read(
31
+ url=url,
32
+ stealth=self.stealth,
33
+ only_main_content=self.only_main_content
34
+ )
35
+ yield Document(
36
+ page_content=res.markdown,
37
+ metadata={
38
+ "source": res.url,
39
+ "title": res.title,
40
+ "description": res.description,
41
+ "tokens": res.metadata.estimated_tokens,
42
+ "stealth_used": res.metadata.stealth_used
43
+ }
44
+ )
45
+
46
+ def load(self) -> List[Any]:
47
+ return list(self.lazy_load())
@@ -0,0 +1,40 @@
1
+ from typing import List, Optional, Any
2
+ from clearfetch.client import ClearFetch
3
+
4
+ class ClearFetchReader:
5
+ """LlamaIndex Document Reader for ClearFetch."""
6
+ def __init__(self, api_key: Optional[str] = None):
7
+ self.client = ClearFetch(api_key=api_key)
8
+
9
+ def load_data(
10
+ self,
11
+ urls: List[str],
12
+ stealth: str = "auto",
13
+ only_main_content: bool = True
14
+ ) -> List[Any]:
15
+ try:
16
+ from llama_index.core.schema import Document
17
+ except ImportError:
18
+ from dataclasses import dataclass
19
+ @dataclass
20
+ class Document:
21
+ text: str
22
+ extra_info: dict
23
+
24
+ documents = []
25
+ for url in urls:
26
+ res = self.client.read(
27
+ url=url,
28
+ stealth=stealth,
29
+ only_main_content=only_main_content
30
+ )
31
+ doc = Document(
32
+ text=res.markdown,
33
+ extra_info={
34
+ "url": res.url,
35
+ "title": res.title,
36
+ "tokens": res.metadata.estimated_tokens
37
+ }
38
+ )
39
+ documents.append(doc)
40
+ return documents
clearfetch/types.py ADDED
@@ -0,0 +1,53 @@
1
+ from typing import List, Dict, Any, Optional
2
+ from dataclasses import dataclass
3
+
4
+ @dataclass
5
+ class Metadata:
6
+ status_code: int
7
+ cached: bool
8
+ stealth_used: bool
9
+ estimated_tokens: int
10
+ latency_ms: int
11
+ credits_used: int
12
+
13
+ @dataclass
14
+ class ReadResult:
15
+ success: bool
16
+ url: str
17
+ title: str
18
+ description: str
19
+ markdown: str
20
+ links: List[str]
21
+ metadata: Metadata
22
+
23
+ @dataclass
24
+ class ExtractResult:
25
+ success: bool
26
+ url: str
27
+ data: Dict[str, Any]
28
+ metadata: Metadata
29
+
30
+ @dataclass
31
+ class SearchItem:
32
+ title: str
33
+ url: str
34
+ snippet: str
35
+ markdown: Optional[str] = None
36
+ estimated_tokens: Optional[int] = None
37
+
38
+ @dataclass
39
+ class SearchResult:
40
+ success: bool
41
+ query: str
42
+ count: int
43
+ results: List[SearchItem]
44
+ total_estimated_tokens: int
45
+ credits_used: int
46
+
47
+ @dataclass
48
+ class UsageResult:
49
+ credits_balance: int
50
+ plan_tier: str
51
+ concurrency_limit: int
52
+ rate_limit_per_min: int
53
+ recent_logs: List[Dict[str, Any]]
@@ -0,0 +1,146 @@
1
+ Metadata-Version: 2.4
2
+ Name: clearfetch
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for ClearFetch (clearfetch.dev) - Unblocked Web & Anti-Bot Markdown/JSON Extraction for AI Agents.
5
+ Author-email: ClearFetch Team <support@clearfetch.dev>
6
+ License: MIT
7
+ Project-URL: Homepage, https://clearfetch.dev
8
+ Project-URL: Documentation, https://clearfetch.dev/docs
9
+ Project-URL: Repository, https://github.com/clearfetch/clearfetch-python
10
+ Keywords: clearfetch,web-scraper,anti-bot,cloudflare-turnstile,datadome,ai-agent,llm,langchain,llamaindex,rag
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Internet :: WWW/HTTP
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: httpx>=0.25.0
24
+ Provides-Extra: langchain
25
+ Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
26
+ Provides-Extra: llamaindex
27
+ Requires-Dist: llama-index-core>=0.10.0; extra == "llamaindex"
28
+ Provides-Extra: all
29
+ Requires-Dist: langchain-core>=0.1.0; extra == "all"
30
+ Requires-Dist: llama-index-core>=0.10.0; extra == "all"
31
+
32
+ # ClearFetch Python SDK (`clearfetch`)
33
+
34
+ > **Official Python Client for ClearFetch ([clearfetch.dev](https://clearfetch.dev))**
35
+ > Unblocked web access, residential Cloudflare Turnstile / DataDome bypass, and clean Markdown / structured JSON extraction for autonomous AI agents, LangChain, and LlamaIndex.
36
+
37
+ ---
38
+
39
+ ## ⚡ Installation
40
+
41
+ ```bash
42
+ pip install clearfetch
43
+ ```
44
+
45
+ *(Optional integrations)*
46
+ ```bash
47
+ pip install "clearfetch[langchain]"
48
+ pip install "clearfetch[llamaindex]"
49
+ ```
50
+
51
+ ---
52
+
53
+ ## 🚀 Quick Start
54
+
55
+ ### 1. Read Any Webpage as Clean Markdown
56
+
57
+ ```python
58
+ from clearfetch import ClearFetch
59
+
60
+ # Initialize client (uses CLEARFETCH_API_KEY env var by default)
61
+ client = ClearFetch(api_key="cf_live_your_key_here")
62
+
63
+ # Automatically bypasses Turnstile & DataDome and returns clean Markdown
64
+ doc = client.read("https://www.bloomberg.com/markets")
65
+
66
+ print("Title:", doc.title)
67
+ print("Tokens:", doc.metadata.estimated_tokens)
68
+ print("Content:\n", doc.markdown)
69
+ ```
70
+
71
+ ---
72
+
73
+ ### 2. Async Client for High-Concurrency Multi-Agent Frameworks
74
+
75
+ ```python
76
+ import asyncio
77
+ from clearfetch import AsyncClearFetch
78
+
79
+ async def main():
80
+ client = AsyncClearFetch(api_key="cf_live_your_key_here")
81
+ doc = await client.read("https://news.ycombinator.com")
82
+ print(doc.markdown)
83
+
84
+ asyncio.run(main())
85
+ ```
86
+
87
+ ---
88
+
89
+ ### 3. Extract Typed Structured JSON (LLM Schema Enforcement)
90
+
91
+ ```python
92
+ schema = {
93
+ "type": "object",
94
+ "properties": {
95
+ "headline": {"type": "string"},
96
+ "market_index": {"type": "string"},
97
+ "points_change": {"type": "number"}
98
+ },
99
+ "required": ["headline"]
100
+ }
101
+
102
+ result = client.extract(
103
+ url="https://www.bloomberg.com/markets",
104
+ json_schema=schema,
105
+ prompt="Extract top market index status"
106
+ )
107
+
108
+ print(result.data)
109
+ ```
110
+
111
+ ---
112
+
113
+ ### 4. LangChain Integration
114
+
115
+ ```python
116
+ from clearfetch import ClearFetchLoader
117
+
118
+ loader = ClearFetchLoader(
119
+ urls=["https://www.reddit.com/r/technology"],
120
+ api_key="cf_live_your_key_here"
121
+ )
122
+
123
+ docs = loader.load()
124
+ print(docs[0].page_content)
125
+ ```
126
+
127
+ ---
128
+
129
+ ### 5. CLI Terminal Usage
130
+
131
+ ```bash
132
+ # Export your key
133
+ export CLEARFETCH_API_KEY="cf_live_..."
134
+
135
+ # Scrape to Markdown
136
+ clearfetch read https://example.com
137
+
138
+ # Live search and bundle
139
+ clearfetch search "Autonomous AI agents" --limit 3
140
+ ```
141
+
142
+ ---
143
+
144
+ ## 📄 License
145
+
146
+ MIT License. Developed by ClearFetch Team ([clearfetch.dev](https://clearfetch.dev)).
@@ -0,0 +1,12 @@
1
+ clearfetch/__init__.py,sha256=6Dd-i0LBT8TUcwszIJaDLprgXPBoY9u50zrWvZIWiHY,568
2
+ clearfetch/cli.py,sha256=XrzHW13WF6e2KSXSBAjOJif-ga9SyHg0eDmjHeKWOu0,3480
3
+ clearfetch/client.py,sha256=-mogpUoknxsfdcdEd3I15B9Iv6NvMQZyWT-78iL8ZSo,11057
4
+ clearfetch/types.py,sha256=QN4kA4tnq3f84XcZ1ST4NivRPQI2-dJhWeyTdPaEsTM,992
5
+ clearfetch/integrations/__init__.py,sha256=sUPJXUlR8yTpMRyTlY4V44TebwkIMn8Xic0RXwesA5s,179
6
+ clearfetch/integrations/langchain.py,sha256=FpiOwcfGCu3USid-8iibfbwWVvND1ntIQNznxCtyb3g,1599
7
+ clearfetch/integrations/llamaindex.py,sha256=-44VaX3kYJ6II3XAiAttWvWZ0F4q1aqz-hyhAIMyZqk,1194
8
+ clearfetch-1.0.0.dist-info/METADATA,sha256=LIDUfA9gO_GaRWanTCE6cHDWSw--_O6xsaRc3cM_VW0,3941
9
+ clearfetch-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
10
+ clearfetch-1.0.0.dist-info/entry_points.txt,sha256=tHsx35WAPzazxTXmDQUTzPcm-Zql3qJiQhjISTK0wcQ,51
11
+ clearfetch-1.0.0.dist-info/top_level.txt,sha256=OdQcivh6AYeMuJ8hd45HnoKKmHeVtygOYi8HPG80VRA,11
12
+ clearfetch-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ clearfetch = clearfetch.cli:main
@@ -0,0 +1 @@
1
+ clearfetch