fetchfox-sdk 1.0.0 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fetchfox-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "AI scraper",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/crawl.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { call } from './api.js';
2
2
 
3
- export const crawl = async (pattern, options) => {
4
- return call('POST', '/api/crawl', { pattern, ...options });
3
+ export const crawl = async (args) => {
4
+ return call('POST', '/api/crawl', args);
5
5
  };
package/src/extract.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { call } from './api.js';
2
2
 
3
- export const extract = async (urls, template, options) => {
4
- return call('POST', '/api/extract', { urls, template, ...options });
3
+ export const extract = async (args) => {
4
+ return call('POST', '/api/extract', args);
5
5
  };
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './scrape.js';
1
2
  export * from './crawl.js';
2
3
  export * from './extract.js';
3
4
  export * from './jobs.js';
package/src/jobs.js CHANGED
@@ -4,7 +4,9 @@ export const jobs = {
4
4
  get: async (id) => {
5
5
  return call('GET', `/api/jobs/${id}`);
6
6
  },
7
- list: async (limit = 100, offset = 0) => {
7
+ list: async (args) => {
8
+ const limit = args?.limit ?? 100;
9
+ const offset = args?.offset ?? 0;
8
10
  return call('GET', '/api/jobs', { limit, offset });
9
11
  },
10
12
  };
package/src/scrape.js ADDED
@@ -0,0 +1,5 @@
1
+ import { call } from './api.js';
2
+
3
+ export const scrape = async (args) => {
4
+ return call('POST', '/api/scrape', args);
5
+ };
@@ -1,6 +1,9 @@
1
1
  import { crawl } from '../src';
2
2
 
3
3
  test('crawl a pattern @sanity', async () => {
4
- const out = await crawl('https://pokemondb.net/pokedex/*', { maxVisits: 5 });
4
+ const out = await crawl({
5
+ pattern: 'https://pokemondb.net/pokedex/*',
6
+ maxVisits: 5,
7
+ });
5
8
  console.log(out);
6
9
  }, 30_000);