@hydrafetch/node-sdk 0.5.0 → 0.7.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 CHANGED
@@ -166,6 +166,43 @@ const { results } = await hf.search('post-quantum TLS adoption', {
166
166
  results.forEach((r) => console.log(r.title, r.url, r.data?.markdown));
167
167
  ```
168
168
 
169
+ ## News
170
+
171
+ Find recent news articles about anything, newest first, each with its outlet and publish time:
172
+
173
+ ```ts
174
+ const { results } = await hf.news('acme raises funding', { timeRange: 'week', limit: 10 });
175
+
176
+ results.forEach((a) => console.log(a.publishedAt, a.source, a.title, a.url));
177
+ ```
178
+
179
+ A news search costs 1 credit, and one that finds nothing is free. Set `scrapeResults: true` to also read each article as clean data, at 1 extra credit per article.
180
+
181
+ ## Jobs
182
+
183
+ Search open jobs collected from company career sites and hiring platforms, by the words in the job title:
184
+
185
+ ```ts
186
+ const jobs = await hf.searchJobs('data engineer', {
187
+ location: 'Berlin',
188
+ postedWithinDays: 14,
189
+ limit: 20,
190
+ });
191
+
192
+ jobs.forEach((j) => console.log(j.title, j.company, j.location, j.url));
193
+ ```
194
+
195
+ See what changed in a company's hiring since a date: what is open now, what opened and what closed, by department, seniority and location, with the jobs themselves:
196
+
197
+ ```ts
198
+ const [acme] = await hf.hiringChanges('acme.com', '2026-10-01');
199
+
200
+ console.log(acme.totals); // { open: 42, opened: 6, closed: 3 }
201
+ acme.opened.forEach((j) => console.log(j.title, j.seniority, j.firstSeenAt));
202
+ ```
203
+
204
+ A search costs 1 credit per 10 jobs returned, and an empty one is free. Hiring changes cost 1 credit per company we have jobs for; companies we do not track yet come back empty and are free.
205
+
169
206
  ## Brand data
170
207
 
171
208
  ```ts
@@ -251,6 +288,9 @@ const hf = new Hydrafetch({
251
288
  | `markdown(url, options?)` | `string` | 1 |
252
289
  | `map(url, options?)` | `MapResult` | 1 |
253
290
  | `search(query, options?)` | `SearchResult` | 1 + 1 per scraped result |
291
+ | `news(query, options?)` | `NewsResult` | 1 + 1 per article read; free when empty |
292
+ | `searchJobs(query, options?)` | `OpenJob[]` | 1 per 10 jobs |
293
+ | `hiringChanges(domains, since, options?)` | `CompanyHiringChanges[]` | 1 per company with jobs |
254
294
  | `extract(urls, options?)` | `ExtractResult<T>` | 5 per URL |
255
295
  | `brand(domain)` | `BrandResult` | 5 |
256
296
  | `logo(domain, options?)` | `LogoResult` | 1 |
package/dist/index.cjs CHANGED
@@ -235,6 +235,19 @@ var Hydrafetch = class {
235
235
  search(query, options = {}) {
236
236
  return this.request("POST", "/v1/web/search", { query, ...options });
237
237
  }
238
+ news(query, options = {}) {
239
+ return this.request("POST", "/v1/web/news", { query, ...options });
240
+ }
241
+ searchJobs(query, options = {}) {
242
+ return this.request("POST", "/v1/web/index/jobs/search", { query, ...options });
243
+ }
244
+ hiringChanges(domains, since, options = {}) {
245
+ return this.request("POST", "/v1/web/index/jobs/changes", {
246
+ domains: Array.isArray(domains) ? domains : [domains],
247
+ since: since instanceof Date ? since.toISOString() : since,
248
+ ...options
249
+ });
250
+ }
238
251
  async extract(urls, options = {}) {
239
252
  const { schema, ...rest } = options;
240
253
  return this.request("POST", "/v1/web/extract", {
package/dist/index.d.cts CHANGED
@@ -252,6 +252,112 @@ interface RateResultResponse {
252
252
  requestId: string;
253
253
  rating: ResultRating;
254
254
  }
255
+ interface SearchJobsOptions {
256
+ /** A city, region or country to match, like "Berlin". */
257
+ location?: string;
258
+ /** Only jobs marked remote. */
259
+ remoteOnly?: boolean;
260
+ /** Only jobs posted in the last N days (1 to 365). */
261
+ postedWithinDays?: number;
262
+ /** Max jobs to return, 1 to 100 (default 10). Each 10 jobs returned cost 1 credit. */
263
+ limit?: number;
264
+ /** Include each job's description text when we hold it. */
265
+ includeDescriptions?: boolean;
266
+ }
267
+ interface JobPay {
268
+ min: number | null;
269
+ max: number | null;
270
+ currency: string | null;
271
+ interval: string | null;
272
+ }
273
+ interface OpenJob {
274
+ title: string;
275
+ company: string | null;
276
+ /** The company's website. */
277
+ domain: string;
278
+ /** The hiring platform the job is posted on. */
279
+ board: string;
280
+ department: string | null;
281
+ location: string | null;
282
+ remote: boolean | null;
283
+ employmentType: string | null;
284
+ postedAt: string | null;
285
+ /** When the job was first seen open. */
286
+ firstSeenAt: string;
287
+ url: string | null;
288
+ applyUrl: string | null;
289
+ pay: JobPay | null;
290
+ description?: string | null;
291
+ }
292
+ interface HiringChangesOptions {
293
+ /** Include each opened and closed job's description text when we hold it. */
294
+ includeDescriptions?: boolean;
295
+ }
296
+ interface HiringCounts {
297
+ open: number;
298
+ opened: number;
299
+ closed: number;
300
+ }
301
+ interface HiringChangePosting {
302
+ title: string;
303
+ department: string | null;
304
+ location: string | null;
305
+ seniority: string;
306
+ board: string;
307
+ url: string | null;
308
+ postedAt: string | null;
309
+ firstSeenAt: string;
310
+ closedAt: string | null;
311
+ description?: string | null;
312
+ }
313
+ interface CompanyHiringChanges {
314
+ domain: string;
315
+ company: string | null;
316
+ lastReadAt: string | null;
317
+ since: string;
318
+ totals: HiringCounts;
319
+ byDepartment: Record<string, HiringCounts>;
320
+ bySeniority: Record<string, HiringCounts>;
321
+ byLocation: Record<string, HiringCounts>;
322
+ opened: HiringChangePosting[];
323
+ closed: HiringChangePosting[];
324
+ truncated: boolean;
325
+ }
326
+ type NewsTimeRange = 'hour' | 'day' | 'week' | 'month';
327
+ interface NewsOptions {
328
+ /** Max articles to return, 1 to 50 (default 10). */
329
+ limit?: number;
330
+ /** Only articles published within this window before now (default "week"). */
331
+ timeRange?: NewsTimeRange;
332
+ /** ISO 3166 alpha-2 country code to lean results toward, like "us". */
333
+ country?: string;
334
+ /** Only articles from these sites, up to 15. */
335
+ includeDomains?: string[];
336
+ /** Drop articles from these sites, up to 15. */
337
+ excludeDomains?: string[];
338
+ /** Also read each article as clean data, 1 extra credit per article read. */
339
+ scrapeResults?: boolean;
340
+ scrapeOptions?: ScrapeOptions;
341
+ }
342
+ interface NewsArticle {
343
+ title: string;
344
+ /** The article's address on the publisher's own site. */
345
+ url: string;
346
+ /** The outlet that published it. */
347
+ source: string | null;
348
+ /** When it was published, ISO 8601. */
349
+ publishedAt: string;
350
+ snippet: string | null;
351
+ imageUrl: string | null;
352
+ /** The article read as clean data when scrapeResults is on, otherwise null. */
353
+ data: ScrapeResult | null;
354
+ }
355
+ interface NewsResult {
356
+ query: string;
357
+ status: 'ok' | 'no_results';
358
+ /** Newest first. */
359
+ results: NewsArticle[];
360
+ }
255
361
 
256
362
  interface HydrafetchOptions {
257
363
  apiKey?: string;
@@ -275,6 +381,9 @@ declare class Hydrafetch {
275
381
  rateResult(input: RateResultInput): Promise<RateResultResponse>;
276
382
  map(url: string, options?: MapOptions): Promise<MapResult>;
277
383
  search(query: string, options?: SearchOptions): Promise<SearchResult>;
384
+ news(query: string, options?: NewsOptions): Promise<NewsResult>;
385
+ searchJobs(query: string, options?: SearchJobsOptions): Promise<OpenJob[]>;
386
+ hiringChanges(domains: string | string[], since: string | Date, options?: HiringChangesOptions): Promise<CompanyHiringChanges[]>;
278
387
  extract<T = unknown>(urls: string | string[], options?: ExtractOptions): Promise<ExtractResult<T>>;
279
388
  brand(domain: string): Promise<BrandResult>;
280
389
  logo(domain: string, options?: BrandOptions): Promise<LogoResult>;
@@ -314,4 +423,4 @@ declare class HydrafetchTimeoutError extends HydrafetchError {
314
423
  constructor(message: string);
315
424
  }
316
425
 
317
- 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 Location, type LogoResult, type MapOptions, type MapResult, type PageImage, type PageMetadata, type RateResultInput, type RateResultResponse, type ResultFeedbackReason, type ResultRating, 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 };
426
+ export { type BatchOptions, type BrandOptions, type BrandResult, type CompanyHiringChanges, type CrawlOptions, type ExtractItem, type ExtractOptions, type ExtractResult, type ExtractSchema, type Format, type HiringChangePosting, type HiringChangesOptions, type HiringCounts, Hydrafetch, HydrafetchError, type HydrafetchOptions, HydrafetchTimeoutError, type ImagesResult, type JobPage, type JobPay, type JobResult, type JobStatus, type Location, type LogoResult, type MapOptions, type MapResult, type NewsArticle, type NewsOptions, type NewsResult, type NewsTimeRange, type OpenJob, type PageImage, type PageMetadata, type RateResultInput, type RateResultResponse, type ResultFeedbackReason, type ResultRating, type ScrapeBase, type ScrapeContent, type ScrapeOptions, type ScrapeResult, type ScreenshotOptions, type ScreenshotResult, type SearchJobsOptions, type SearchOptions, type SearchResult, type SearchResultItem, type StyleguideOptions, type StyleguideResult, type Usage, type WaitOptions, type ZodLike };
package/dist/index.d.ts CHANGED
@@ -252,6 +252,112 @@ interface RateResultResponse {
252
252
  requestId: string;
253
253
  rating: ResultRating;
254
254
  }
255
+ interface SearchJobsOptions {
256
+ /** A city, region or country to match, like "Berlin". */
257
+ location?: string;
258
+ /** Only jobs marked remote. */
259
+ remoteOnly?: boolean;
260
+ /** Only jobs posted in the last N days (1 to 365). */
261
+ postedWithinDays?: number;
262
+ /** Max jobs to return, 1 to 100 (default 10). Each 10 jobs returned cost 1 credit. */
263
+ limit?: number;
264
+ /** Include each job's description text when we hold it. */
265
+ includeDescriptions?: boolean;
266
+ }
267
+ interface JobPay {
268
+ min: number | null;
269
+ max: number | null;
270
+ currency: string | null;
271
+ interval: string | null;
272
+ }
273
+ interface OpenJob {
274
+ title: string;
275
+ company: string | null;
276
+ /** The company's website. */
277
+ domain: string;
278
+ /** The hiring platform the job is posted on. */
279
+ board: string;
280
+ department: string | null;
281
+ location: string | null;
282
+ remote: boolean | null;
283
+ employmentType: string | null;
284
+ postedAt: string | null;
285
+ /** When the job was first seen open. */
286
+ firstSeenAt: string;
287
+ url: string | null;
288
+ applyUrl: string | null;
289
+ pay: JobPay | null;
290
+ description?: string | null;
291
+ }
292
+ interface HiringChangesOptions {
293
+ /** Include each opened and closed job's description text when we hold it. */
294
+ includeDescriptions?: boolean;
295
+ }
296
+ interface HiringCounts {
297
+ open: number;
298
+ opened: number;
299
+ closed: number;
300
+ }
301
+ interface HiringChangePosting {
302
+ title: string;
303
+ department: string | null;
304
+ location: string | null;
305
+ seniority: string;
306
+ board: string;
307
+ url: string | null;
308
+ postedAt: string | null;
309
+ firstSeenAt: string;
310
+ closedAt: string | null;
311
+ description?: string | null;
312
+ }
313
+ interface CompanyHiringChanges {
314
+ domain: string;
315
+ company: string | null;
316
+ lastReadAt: string | null;
317
+ since: string;
318
+ totals: HiringCounts;
319
+ byDepartment: Record<string, HiringCounts>;
320
+ bySeniority: Record<string, HiringCounts>;
321
+ byLocation: Record<string, HiringCounts>;
322
+ opened: HiringChangePosting[];
323
+ closed: HiringChangePosting[];
324
+ truncated: boolean;
325
+ }
326
+ type NewsTimeRange = 'hour' | 'day' | 'week' | 'month';
327
+ interface NewsOptions {
328
+ /** Max articles to return, 1 to 50 (default 10). */
329
+ limit?: number;
330
+ /** Only articles published within this window before now (default "week"). */
331
+ timeRange?: NewsTimeRange;
332
+ /** ISO 3166 alpha-2 country code to lean results toward, like "us". */
333
+ country?: string;
334
+ /** Only articles from these sites, up to 15. */
335
+ includeDomains?: string[];
336
+ /** Drop articles from these sites, up to 15. */
337
+ excludeDomains?: string[];
338
+ /** Also read each article as clean data, 1 extra credit per article read. */
339
+ scrapeResults?: boolean;
340
+ scrapeOptions?: ScrapeOptions;
341
+ }
342
+ interface NewsArticle {
343
+ title: string;
344
+ /** The article's address on the publisher's own site. */
345
+ url: string;
346
+ /** The outlet that published it. */
347
+ source: string | null;
348
+ /** When it was published, ISO 8601. */
349
+ publishedAt: string;
350
+ snippet: string | null;
351
+ imageUrl: string | null;
352
+ /** The article read as clean data when scrapeResults is on, otherwise null. */
353
+ data: ScrapeResult | null;
354
+ }
355
+ interface NewsResult {
356
+ query: string;
357
+ status: 'ok' | 'no_results';
358
+ /** Newest first. */
359
+ results: NewsArticle[];
360
+ }
255
361
 
256
362
  interface HydrafetchOptions {
257
363
  apiKey?: string;
@@ -275,6 +381,9 @@ declare class Hydrafetch {
275
381
  rateResult(input: RateResultInput): Promise<RateResultResponse>;
276
382
  map(url: string, options?: MapOptions): Promise<MapResult>;
277
383
  search(query: string, options?: SearchOptions): Promise<SearchResult>;
384
+ news(query: string, options?: NewsOptions): Promise<NewsResult>;
385
+ searchJobs(query: string, options?: SearchJobsOptions): Promise<OpenJob[]>;
386
+ hiringChanges(domains: string | string[], since: string | Date, options?: HiringChangesOptions): Promise<CompanyHiringChanges[]>;
278
387
  extract<T = unknown>(urls: string | string[], options?: ExtractOptions): Promise<ExtractResult<T>>;
279
388
  brand(domain: string): Promise<BrandResult>;
280
389
  logo(domain: string, options?: BrandOptions): Promise<LogoResult>;
@@ -314,4 +423,4 @@ declare class HydrafetchTimeoutError extends HydrafetchError {
314
423
  constructor(message: string);
315
424
  }
316
425
 
317
- 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 Location, type LogoResult, type MapOptions, type MapResult, type PageImage, type PageMetadata, type RateResultInput, type RateResultResponse, type ResultFeedbackReason, type ResultRating, 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 };
426
+ export { type BatchOptions, type BrandOptions, type BrandResult, type CompanyHiringChanges, type CrawlOptions, type ExtractItem, type ExtractOptions, type ExtractResult, type ExtractSchema, type Format, type HiringChangePosting, type HiringChangesOptions, type HiringCounts, Hydrafetch, HydrafetchError, type HydrafetchOptions, HydrafetchTimeoutError, type ImagesResult, type JobPage, type JobPay, type JobResult, type JobStatus, type Location, type LogoResult, type MapOptions, type MapResult, type NewsArticle, type NewsOptions, type NewsResult, type NewsTimeRange, type OpenJob, type PageImage, type PageMetadata, type RateResultInput, type RateResultResponse, type ResultFeedbackReason, type ResultRating, type ScrapeBase, type ScrapeContent, type ScrapeOptions, type ScrapeResult, type ScreenshotOptions, type ScreenshotResult, type SearchJobsOptions, type SearchOptions, type SearchResult, type SearchResultItem, type StyleguideOptions, type StyleguideResult, type Usage, type WaitOptions, type ZodLike };
package/dist/index.js CHANGED
@@ -207,6 +207,19 @@ var Hydrafetch = class {
207
207
  search(query, options = {}) {
208
208
  return this.request("POST", "/v1/web/search", { query, ...options });
209
209
  }
210
+ news(query, options = {}) {
211
+ return this.request("POST", "/v1/web/news", { query, ...options });
212
+ }
213
+ searchJobs(query, options = {}) {
214
+ return this.request("POST", "/v1/web/index/jobs/search", { query, ...options });
215
+ }
216
+ hiringChanges(domains, since, options = {}) {
217
+ return this.request("POST", "/v1/web/index/jobs/changes", {
218
+ domains: Array.isArray(domains) ? domains : [domains],
219
+ since: since instanceof Date ? since.toISOString() : since,
220
+ ...options
221
+ });
222
+ }
210
223
  async extract(urls, options = {}) {
211
224
  const { schema, ...rest } = options;
212
225
  return this.request("POST", "/v1/web/extract", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydrafetch/node-sdk",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Official Node/TypeScript client for the Hydrafetch web data API. Turn any URL into clean Markdown and structured data.",
5
5
  "keywords": [
6
6
  "hydrafetch",