@browserbasehq/sdk 1.2.0 → 1.2.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/dist/index.js CHANGED
@@ -134,12 +134,10 @@ class Browserbase {
134
134
  await page.goto(url);
135
135
  let html = await page.content();
136
136
  if (options.textContent) {
137
- const readable = await page.evaluate(async () => {
138
- const readability = await import(
139
- // @ts-ignore
140
- 'https://cdn.skypack.dev/@mozilla/readability');
141
- return new readability.Readability(document).parse();
142
- });
137
+ const readable = await page.evaluate(`
138
+ import('https://cdn.skypack.dev/@mozilla/readability').then(readability => {
139
+ return new readability.Readability(document).parse()
140
+ })`);
143
141
  html = `${readable.title}\n${readable.textContent}`;
144
142
  }
145
143
  await browser.close();
@@ -161,12 +159,10 @@ class Browserbase {
161
159
  await page.goto(url);
162
160
  let html = await page.content();
163
161
  if (options.textContent) {
164
- const readable = await page.evaluate(async () => {
165
- const readability = await import(
166
- // @ts-ignore
167
- 'https://cdn.skypack.dev/@mozilla/readability');
168
- return new readability.Readability(document).parse();
169
- });
162
+ const readable = await page.evaluate(`
163
+ import('https://cdn.skypack.dev/@mozilla/readability').then(readability => {
164
+ return new readability.Readability(document).parse()
165
+ })`);
170
166
  html = `${readable.title}\n${readable.textContent}`;
171
167
  }
172
168
  yield html;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbasehq/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Browserbase JS SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -275,13 +275,11 @@ export default class Browserbase {
275
275
  let html = await page.content()
276
276
 
277
277
  if (options.textContent) {
278
- const readable = await page.evaluate(async () => {
279
- const readability = await import(
280
- // @ts-ignore
281
- 'https://cdn.skypack.dev/@mozilla/readability'
282
- )
283
- return new readability.Readability(document).parse()
284
- })
278
+ const readable: { title?: string; textContent?: string } =
279
+ await page.evaluate(`
280
+ import('https://cdn.skypack.dev/@mozilla/readability').then(readability => {
281
+ return new readability.Readability(document).parse()
282
+ })`)
285
283
  html = `${readable.title}\n${readable.textContent}`
286
284
  }
287
285
 
@@ -312,13 +310,11 @@ export default class Browserbase {
312
310
  let html = await page.content()
313
311
 
314
312
  if (options.textContent) {
315
- const readable = await page.evaluate(async () => {
316
- const readability = await import(
317
- // @ts-ignore
318
- 'https://cdn.skypack.dev/@mozilla/readability'
319
- )
320
- return new readability.Readability(document).parse()
321
- })
313
+ const readable: { title?: string; textContent?: string } =
314
+ await page.evaluate(`
315
+ import('https://cdn.skypack.dev/@mozilla/readability').then(readability => {
316
+ return new readability.Readability(document).parse()
317
+ })`)
322
318
  html = `${readable.title}\n${readable.textContent}`
323
319
  }
324
320