@hydrafetch/node-sdk 0.2.0 → 0.3.0
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 +2 -1
- package/dist/index.cjs +6 -2
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -162,6 +162,7 @@ results.forEach((r) => console.log(r.title, r.url, r.data?.markdown));
|
|
|
162
162
|
await hf.brand('stripe.com'); // logos, colours, fonts, socials
|
|
163
163
|
await hf.logo('stripe.com', { theme: 'dark', type: 'icon' }); // one asset
|
|
164
164
|
await hf.styleguide('stripe.com'); // computed design system
|
|
165
|
+
await hf.styleguide('https://stripe.com/pricing', { maxAge: 0 }); // one page, read fresh
|
|
165
166
|
```
|
|
166
167
|
|
|
167
168
|
For logos in a browser use [`@hydrafetch/client-sdk`](https://github.com/Hydrafetch/client-sdk) or [`@hydrafetch/react`](https://github.com/Hydrafetch/react-sdk) with a publishable key. Those bill against logo pulls rather than credits.
|
|
@@ -225,7 +226,7 @@ const hf = new Hydrafetch({
|
|
|
225
226
|
| `extract(urls, options?)` | `ExtractResult<T>` | 5 per URL |
|
|
226
227
|
| `brand(domain)` | `BrandResult` | 5 |
|
|
227
228
|
| `logo(domain, options?)` | `LogoResult` | 1 |
|
|
228
|
-
| `styleguide(
|
|
229
|
+
| `styleguide(domainOrUrl, options?)` | `StyleguideResult` | 10 |
|
|
229
230
|
| `screenshot(url, options?)` | `ScreenshotResult` | 5 |
|
|
230
231
|
| `images(url)` | `ImagesResult` | 1 |
|
|
231
232
|
| `links(url, options?)` | `ScrapeResult<'links'>` | 1 |
|
package/dist/index.cjs
CHANGED
|
@@ -241,8 +241,12 @@ var Hydrafetch = class {
|
|
|
241
241
|
logo(domain, options = {}) {
|
|
242
242
|
return this.request("GET", "/v1/web/brand/logo", void 0, { domain, ...options });
|
|
243
243
|
}
|
|
244
|
-
styleguide(
|
|
245
|
-
|
|
244
|
+
styleguide(domainOrUrl, options = {}) {
|
|
245
|
+
const target = /^https?:\/\//i.test(domainOrUrl) ? { url: domainOrUrl } : { domain: domainOrUrl };
|
|
246
|
+
return this.request("GET", "/v1/web/styleguide", void 0, {
|
|
247
|
+
...target,
|
|
248
|
+
...options
|
|
249
|
+
});
|
|
246
250
|
}
|
|
247
251
|
screenshot(url, options = {}) {
|
|
248
252
|
return this.request("POST", "/v1/web/screenshot", { url, ...options });
|
package/dist/index.d.cts
CHANGED
|
@@ -185,8 +185,12 @@ interface LogoResult {
|
|
|
185
185
|
type?: string;
|
|
186
186
|
[key: string]: unknown;
|
|
187
187
|
}
|
|
188
|
+
interface StyleguideOptions {
|
|
189
|
+
maxAge?: number;
|
|
190
|
+
}
|
|
188
191
|
interface StyleguideResult {
|
|
189
192
|
domain?: string;
|
|
193
|
+
page?: string;
|
|
190
194
|
colors?: Record<string, unknown>;
|
|
191
195
|
typography?: Record<string, unknown>;
|
|
192
196
|
[key: string]: unknown;
|
|
@@ -250,7 +254,7 @@ declare class Hydrafetch {
|
|
|
250
254
|
extract<T = unknown>(urls: string | string[], options?: ExtractOptions): Promise<ExtractResult<T>>;
|
|
251
255
|
brand(domain: string): Promise<BrandResult>;
|
|
252
256
|
logo(domain: string, options?: BrandOptions): Promise<LogoResult>;
|
|
253
|
-
styleguide(
|
|
257
|
+
styleguide(domainOrUrl: string, options?: StyleguideOptions): Promise<StyleguideResult>;
|
|
254
258
|
screenshot(url: string, options?: ScreenshotOptions): Promise<ScreenshotResult>;
|
|
255
259
|
images(url: string, options?: {
|
|
256
260
|
maxAge?: number;
|
|
@@ -286,4 +290,4 @@ declare class HydrafetchTimeoutError extends HydrafetchError {
|
|
|
286
290
|
constructor(message: string);
|
|
287
291
|
}
|
|
288
292
|
|
|
289
|
-
export { type BatchOptions, type BrandOptions, type BrandResult, type CrawlOptions, type ExtractItem, type ExtractOptions, type ExtractResult, type ExtractSchema, type Format, Hydrafetch, HydrafetchError, type HydrafetchOptions, HydrafetchTimeoutError, type ImagesResult, type JobPage, type JobResult, type JobStatus, type LogoResult, type MapOptions, type MapResult, type PageImage, type PageMetadata, type ScrapeBase, type ScrapeContent, type ScrapeOptions, type ScrapeResult, type ScreenshotOptions, type ScreenshotResult, type SearchOptions, type SearchResult, type SearchResultItem, type StyleguideResult, type Usage, type WaitOptions, type ZodLike };
|
|
293
|
+
export { type BatchOptions, type BrandOptions, type BrandResult, type CrawlOptions, type ExtractItem, type ExtractOptions, type ExtractResult, type ExtractSchema, type Format, Hydrafetch, HydrafetchError, type HydrafetchOptions, HydrafetchTimeoutError, type ImagesResult, type JobPage, type JobResult, type JobStatus, type LogoResult, type MapOptions, type MapResult, type PageImage, type PageMetadata, type ScrapeBase, type ScrapeContent, type ScrapeOptions, type ScrapeResult, type ScreenshotOptions, type ScreenshotResult, type SearchOptions, type SearchResult, type SearchResultItem, type StyleguideOptions, type StyleguideResult, type Usage, type WaitOptions, type ZodLike };
|
package/dist/index.d.ts
CHANGED
|
@@ -185,8 +185,12 @@ interface LogoResult {
|
|
|
185
185
|
type?: string;
|
|
186
186
|
[key: string]: unknown;
|
|
187
187
|
}
|
|
188
|
+
interface StyleguideOptions {
|
|
189
|
+
maxAge?: number;
|
|
190
|
+
}
|
|
188
191
|
interface StyleguideResult {
|
|
189
192
|
domain?: string;
|
|
193
|
+
page?: string;
|
|
190
194
|
colors?: Record<string, unknown>;
|
|
191
195
|
typography?: Record<string, unknown>;
|
|
192
196
|
[key: string]: unknown;
|
|
@@ -250,7 +254,7 @@ declare class Hydrafetch {
|
|
|
250
254
|
extract<T = unknown>(urls: string | string[], options?: ExtractOptions): Promise<ExtractResult<T>>;
|
|
251
255
|
brand(domain: string): Promise<BrandResult>;
|
|
252
256
|
logo(domain: string, options?: BrandOptions): Promise<LogoResult>;
|
|
253
|
-
styleguide(
|
|
257
|
+
styleguide(domainOrUrl: string, options?: StyleguideOptions): Promise<StyleguideResult>;
|
|
254
258
|
screenshot(url: string, options?: ScreenshotOptions): Promise<ScreenshotResult>;
|
|
255
259
|
images(url: string, options?: {
|
|
256
260
|
maxAge?: number;
|
|
@@ -286,4 +290,4 @@ declare class HydrafetchTimeoutError extends HydrafetchError {
|
|
|
286
290
|
constructor(message: string);
|
|
287
291
|
}
|
|
288
292
|
|
|
289
|
-
export { type BatchOptions, type BrandOptions, type BrandResult, type CrawlOptions, type ExtractItem, type ExtractOptions, type ExtractResult, type ExtractSchema, type Format, Hydrafetch, HydrafetchError, type HydrafetchOptions, HydrafetchTimeoutError, type ImagesResult, type JobPage, type JobResult, type JobStatus, type LogoResult, type MapOptions, type MapResult, type PageImage, type PageMetadata, type ScrapeBase, type ScrapeContent, type ScrapeOptions, type ScrapeResult, type ScreenshotOptions, type ScreenshotResult, type SearchOptions, type SearchResult, type SearchResultItem, type StyleguideResult, type Usage, type WaitOptions, type ZodLike };
|
|
293
|
+
export { type BatchOptions, type BrandOptions, type BrandResult, type CrawlOptions, type ExtractItem, type ExtractOptions, type ExtractResult, type ExtractSchema, type Format, Hydrafetch, HydrafetchError, type HydrafetchOptions, HydrafetchTimeoutError, type ImagesResult, type JobPage, type JobResult, type JobStatus, type LogoResult, type MapOptions, type MapResult, type PageImage, type PageMetadata, type ScrapeBase, type ScrapeContent, type ScrapeOptions, type ScrapeResult, type ScreenshotOptions, type ScreenshotResult, type SearchOptions, type SearchResult, type SearchResultItem, type StyleguideOptions, type StyleguideResult, type Usage, type WaitOptions, type ZodLike };
|
package/dist/index.js
CHANGED
|
@@ -213,8 +213,12 @@ var Hydrafetch = class {
|
|
|
213
213
|
logo(domain, options = {}) {
|
|
214
214
|
return this.request("GET", "/v1/web/brand/logo", void 0, { domain, ...options });
|
|
215
215
|
}
|
|
216
|
-
styleguide(
|
|
217
|
-
|
|
216
|
+
styleguide(domainOrUrl, options = {}) {
|
|
217
|
+
const target = /^https?:\/\//i.test(domainOrUrl) ? { url: domainOrUrl } : { domain: domainOrUrl };
|
|
218
|
+
return this.request("GET", "/v1/web/styleguide", void 0, {
|
|
219
|
+
...target,
|
|
220
|
+
...options
|
|
221
|
+
});
|
|
218
222
|
}
|
|
219
223
|
screenshot(url, options = {}) {
|
|
220
224
|
return this.request("POST", "/v1/web/screenshot", { url, ...options });
|
package/package.json
CHANGED