minifetch-api 1.4.0 → 1.5.1
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.
- package/README.md +17 -18
- package/dist/esm/client.js +8 -5
- package/dist/esm/utils/payment.js +1 -1
- package/dist/types/client.d.ts +5 -1
- package/package.json +24 -24
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
- ***Or*** an Ethereum or Solana private key for making USDC payments on Base or Solana networks.
|
|
25
25
|
|
|
26
26
|
**Payments.** Two ways to pay:
|
|
27
|
-
1. Credit card + API key. Get started free - [visit our dashboard to Sign Up](https://minifetch.com/dashboard). Create a Minifetch account and it will be auto-loaded with 25 free technical SEO page audits. Top up with your credit card later.
|
|
27
|
+
1. Credit card + API key. Get started free - [visit our dashboard to Sign Up](https://minifetch.com/dashboard). Create a Minifetch account and it will be auto-loaded with credits worth up to 25 free technical SEO page audits. Top up with your credit card later.
|
|
28
28
|
2. USDC on Base or Solana. Just load your wallet with USDC, you're ready. No "gas token" (ETH or SOL) required. You don't need a Minifetch account either, just load your wallet and go!
|
|
29
29
|
|
|
30
30
|
## Install
|
|
@@ -72,7 +72,7 @@ After the Quick Start, you have the following methods to use.
|
|
|
72
72
|
|
|
73
73
|
**Wrap** these methods in a **try/catch** just like in the Quick Start example above. **Code examples** can be also found in the [Github repository /example- directories](https://github.com/Niche-Networks/minifetch-api/).
|
|
74
74
|
|
|
75
|
-
The `checkAndExtract` methods check the target URL's `robots.txt` file to ensure its not blocked and tell us your preferred crawl delay (defaults to 1 second between requests to your domain). So fetching 10 URLs takes at least 10 seconds to complete by default. This is by design, so Minifetch never hammers your server or slows it down for your real users. If the
|
|
75
|
+
The `checkAndExtract` methods check the target URL's `robots.txt` file to ensure its not blocked and tell us your preferred crawl delay (defaults to 1 second between requests to your domain). So fetching 10 URLs takes at least 10 seconds to complete by default. This is by design, so Minifetch never hammers your server or slows it down for your real users. If you own the site and want to allow Minifetch access or to set custom rules for it, read [How To Unblock Minifetch](https://minifetch.com/tutorials/unblock-minifetch).
|
|
76
76
|
|
|
77
77
|
```js
|
|
78
78
|
await client.checkAndRunSeoPageAudit(url);
|
|
@@ -108,9 +108,8 @@ await client.checkAndExtractUrlLinks(url);
|
|
|
108
108
|
|
|
109
109
|
await client.checkAndExtractUrlPreview(url);
|
|
110
110
|
// Price: $0.002
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
// platforms, chat apps and AI.
|
|
111
|
+
// Extracts all fields used for a page's share previews: the lightweight
|
|
112
|
+
// cards that represent the page on social platforms, chat apps, and AI.
|
|
114
113
|
|
|
115
114
|
await client.checkAndExtractUrlContent(url, options);
|
|
116
115
|
// Price: $0.002
|
|
@@ -118,10 +117,14 @@ await client.checkAndExtractUrlContent(url, options);
|
|
|
118
117
|
// an LLM extracts from your page after nav, ads, & scripts are stripped.
|
|
119
118
|
// See what survives for AEO and AI search; respects robots.txt.
|
|
120
119
|
// Options: { includeMediaUrls: true } - defaults to false.
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
For max control, you can also use the following methods directly:
|
|
123
|
+
```js
|
|
124
|
+
await client.preflightCheck(url, options);
|
|
125
|
+
// Free: check if `minfetch` user agent can access target via robots.txt
|
|
126
|
+
// Options: { "fresh": true } - bypass 24hr robots.txt cache, defaults to false
|
|
121
127
|
|
|
122
|
-
// For max control, you can also use the following methods directly.
|
|
123
|
-
// Free: check if `minfetch` user agent can access target via robots.txt:
|
|
124
|
-
await client.preflightCheck(url);
|
|
125
128
|
// Paid methods:
|
|
126
129
|
await client.runSeoPageAudit(url);
|
|
127
130
|
await client.extractUrlMetadata(url, options); // same options as above
|
|
@@ -129,7 +132,6 @@ await client.extractUrlLinks(url);
|
|
|
129
132
|
await client.extractUrlPreview(url);
|
|
130
133
|
await client.extractUrlContent(url, options); // same options as above
|
|
131
134
|
```
|
|
132
|
-
|
|
133
135
|
---
|
|
134
136
|
|
|
135
137
|
### Error Types
|
|
@@ -150,18 +152,15 @@ When you wrap the functions above in a try/catch, here are some of the errors yo
|
|
|
150
152
|
|
|
151
153
|
---
|
|
152
154
|
|
|
153
|
-
###
|
|
154
|
-
Minifetch
|
|
155
|
+
### How We Fetch Web Pages
|
|
156
|
+
Minifetch extracts publicly available metadata and content from pages accessible without authentication or javascript execution.
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
- Ignore robots.txt directives
|
|
158
|
-
- Create accounts or log into user sessions
|
|
159
|
-
- Perform transactional actions (checkout, bidding, purchasing, form submissions)
|
|
160
|
-
- Bypass paywalls or access restricted content
|
|
158
|
+
Every response carries a `proxy` block: the `minifetch` user agent we sent and whether robots.txt was obeyed on the fetch. Proof of how the fetch happened, not just a promise, for regulated use-cases where provenance matters.
|
|
161
159
|
|
|
162
|
-
|
|
160
|
+
Future add-ons:
|
|
161
|
+
- Residential proxies for hard-to-reach pages
|
|
163
162
|
- Javascript execution
|
|
164
|
-
- Access authenticated or logged-in content
|
|
163
|
+
- Access to authenticated or logged-in content
|
|
165
164
|
|
|
166
165
|
---
|
|
167
166
|
|
package/dist/esm/client.js
CHANGED
|
@@ -22,13 +22,18 @@ export class MinifetchClient {
|
|
|
22
22
|
* Check if URL is allowed by robots.txt (free preflight check — no auth required)
|
|
23
23
|
*
|
|
24
24
|
* @param url
|
|
25
|
+
* @param options
|
|
26
|
+
* @param options.fresh
|
|
25
27
|
* @throws {InvalidUrlError} if URL is invalid
|
|
26
28
|
* @throws {NetworkError} if request fails
|
|
27
29
|
*/
|
|
28
|
-
async preflightUrlCheck(url) {
|
|
30
|
+
async preflightUrlCheck(url, options) {
|
|
29
31
|
try {
|
|
30
32
|
const normalizedUrl = validateAndNormalizeUrl(url);
|
|
31
|
-
const
|
|
33
|
+
const params = new URLSearchParams({ url: normalizedUrl });
|
|
34
|
+
if (options?.fresh)
|
|
35
|
+
params.set("fresh", "true");
|
|
36
|
+
const requestUrl = `${this.baseUrl}/api/v1/free/preflight/url-check?${params.toString()}`;
|
|
32
37
|
const response = await fetch(requestUrl);
|
|
33
38
|
if (!response.ok) {
|
|
34
39
|
throw new NetworkError(`Preflight check failed: ${response.status} ${response.statusText}`);
|
|
@@ -221,9 +226,7 @@ export class MinifetchClient {
|
|
|
221
226
|
* @param endpoint
|
|
222
227
|
*/
|
|
223
228
|
_paidPath(endpoint) {
|
|
224
|
-
return this.config.authMode === "x402"
|
|
225
|
-
? `/api/v1/x402${endpoint}`
|
|
226
|
-
: `/api/v1${endpoint}`;
|
|
229
|
+
return this.config.authMode === "x402" ? `/api/v1/x402${endpoint}` : `/api/v1${endpoint}`;
|
|
227
230
|
}
|
|
228
231
|
/**
|
|
229
232
|
* Dispatch to the correct request handler based on auth mode, then
|
|
@@ -29,7 +29,7 @@ export async function handlePayment(url, config) {
|
|
|
29
29
|
}
|
|
30
30
|
else if (isSolana) {
|
|
31
31
|
if (!config.privateKey)
|
|
32
|
-
throw new PaymentFailedError(
|
|
32
|
+
throw new PaymentFailedError("privateKey is required for Solana payments");
|
|
33
33
|
const privateKeyBytes = bs58.decode(config.privateKey);
|
|
34
34
|
const signer = await createKeyPairSignerFromBytes(privateKeyBytes);
|
|
35
35
|
const svmSigner = signer;
|
package/dist/types/client.d.ts
CHANGED
|
@@ -17,10 +17,14 @@ export declare class MinifetchClient {
|
|
|
17
17
|
* Check if URL is allowed by robots.txt (free preflight check — no auth required)
|
|
18
18
|
*
|
|
19
19
|
* @param url
|
|
20
|
+
* @param options
|
|
21
|
+
* @param options.fresh
|
|
20
22
|
* @throws {InvalidUrlError} if URL is invalid
|
|
21
23
|
* @throws {NetworkError} if request fails
|
|
22
24
|
*/
|
|
23
|
-
preflightUrlCheck(url: string
|
|
25
|
+
preflightUrlCheck(url: string, options?: {
|
|
26
|
+
fresh?: boolean;
|
|
27
|
+
}): Promise<PreflightCheckResponse>;
|
|
24
28
|
/**
|
|
25
29
|
* Run SEO page audit (paid endpoint)
|
|
26
30
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minifetch-api",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Minifetch.com API Client.
|
|
3
|
+
"version": "1.5.1",
|
|
4
|
+
"description": "Minifetch.com API Client. Scrape, extract and audit web pages. Pay per URL, no subscription.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
7
7
|
"types": "./dist/types/index.d.ts",
|
|
@@ -17,43 +17,43 @@
|
|
|
17
17
|
"LICENSE"
|
|
18
18
|
],
|
|
19
19
|
"keywords": [
|
|
20
|
+
"html",
|
|
21
|
+
"web page",
|
|
22
|
+
"scraper",
|
|
23
|
+
"parser",
|
|
24
|
+
"metadata",
|
|
25
|
+
"metadata extraction",
|
|
26
|
+
"content extraction",
|
|
27
|
+
"link extraction",
|
|
28
|
+
"hosted",
|
|
29
|
+
"meta tags",
|
|
30
|
+
"open graph",
|
|
31
|
+
"og tags",
|
|
32
|
+
"previews",
|
|
33
|
+
"social cards",
|
|
34
|
+
"twitter cards",
|
|
35
|
+
"pay-per-fetch",
|
|
36
|
+
"pay-per-url",
|
|
37
|
+
"indexing",
|
|
38
|
+
"extract",
|
|
39
|
+
"json-ld",
|
|
40
|
+
"JSON LD",
|
|
41
|
+
"link analysis",
|
|
20
42
|
"SEO",
|
|
21
43
|
"SEO page audit",
|
|
22
44
|
"SEO research",
|
|
23
45
|
"SEO toolkit",
|
|
24
46
|
"SEO skill",
|
|
25
47
|
"technical SEO",
|
|
26
|
-
"pay-per-fetch",
|
|
27
|
-
"pay-per-url",
|
|
28
48
|
"GEO",
|
|
29
49
|
"Generative Engine Optimization",
|
|
30
50
|
"AEO",
|
|
31
51
|
"Answer Engine Optimization",
|
|
32
|
-
"hosted extraction",
|
|
33
|
-
"content extraction",
|
|
34
|
-
"content indexing",
|
|
35
|
-
"extract",
|
|
36
|
-
"html",
|
|
37
|
-
"html parser",
|
|
38
|
-
"json-ld",
|
|
39
|
-
"JSON LD",
|
|
40
|
-
"link analysis",
|
|
41
|
-
"link extraction",
|
|
42
|
-
"metadata",
|
|
43
|
-
"meta tags",
|
|
44
|
-
"open graph",
|
|
45
|
-
"og tags",
|
|
46
52
|
"AI",
|
|
47
53
|
"AI Agents",
|
|
48
54
|
"AI readability",
|
|
49
|
-
"agent skills",
|
|
50
55
|
"automation",
|
|
51
|
-
"monitoring",
|
|
52
56
|
"LLM",
|
|
53
|
-
"previews",
|
|
54
|
-
"social cards",
|
|
55
|
-
"twitter cards",
|
|
56
|
-
"site monitoring",
|
|
57
57
|
"x402",
|
|
58
58
|
"micropayments",
|
|
59
59
|
"usdc"
|