@letsscrapedata/controller 0.0.24 → 0.0.26
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.cjs +17 -5
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +17 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1299,6 +1299,7 @@ var PlaywrightBrowserContext = class extends import_node_events2.default {
|
|
|
1299
1299
|
return null;
|
|
1300
1300
|
}
|
|
1301
1301
|
const page = await this.#browserContext.newPage();
|
|
1302
|
+
await (0, import_utils3.sleep)(2e3);
|
|
1302
1303
|
const pageInfo = page.pageInfo;
|
|
1303
1304
|
if (!pageInfo) {
|
|
1304
1305
|
throw new Error(`Logic error in getPage`);
|
|
@@ -1481,7 +1482,7 @@ var PlaywrightBrowser = class extends import_node_events3.default {
|
|
|
1481
1482
|
return null;
|
|
1482
1483
|
}
|
|
1483
1484
|
const browserContextOptions = {};
|
|
1484
|
-
if (this.#options.
|
|
1485
|
+
if (this.#options.maxWindowSize) {
|
|
1485
1486
|
browserContextOptions.viewport = null;
|
|
1486
1487
|
}
|
|
1487
1488
|
const proxy = options?.proxy ? Object.assign({}, options.proxy) : this.#proxy;
|
|
@@ -2779,6 +2780,7 @@ var PuppeteerBrowserContext = class extends import_node_events5.default {
|
|
|
2779
2780
|
return null;
|
|
2780
2781
|
}
|
|
2781
2782
|
const page = await this.#browserContext.newPage();
|
|
2783
|
+
await (0, import_utils7.sleep)(2e3);
|
|
2782
2784
|
const pageInfo = page.pageInfo;
|
|
2783
2785
|
if (!pageInfo) {
|
|
2784
2786
|
throw new Error(`Logic error in getPage`);
|
|
@@ -17234,6 +17236,7 @@ var LsdBrowserController = class _LsdBrowserController {
|
|
|
17234
17236
|
timeout = 3e4,
|
|
17235
17237
|
args = [],
|
|
17236
17238
|
executablePath = "",
|
|
17239
|
+
maxWindowSize = false,
|
|
17237
17240
|
headless = true,
|
|
17238
17241
|
minBrowserContexts = 1,
|
|
17239
17242
|
// incognito
|
|
@@ -17242,7 +17245,7 @@ var LsdBrowserController = class _LsdBrowserController {
|
|
|
17242
17245
|
userAgent = ""
|
|
17243
17246
|
} = options ? options : {};
|
|
17244
17247
|
const incognito = typeof options?.incognito === "boolean" ? options.incognito : browserControllerType === "puppeteer" ? false : true;
|
|
17245
|
-
const actOptions = { closeFreePagesIntervalSeconds, maxBrowserContextsPerBrowser, maxPagesPerBrowserContext, maxPageFreeSeconds, maxViewportOfNewPage, proxy, timeout, args, executablePath, headless, minBrowserContexts, incognito, proxyPerBrowserContext, userDataDir, userAgent };
|
|
17248
|
+
const actOptions = { closeFreePagesIntervalSeconds, maxBrowserContextsPerBrowser, maxPagesPerBrowserContext, maxPageFreeSeconds, maxViewportOfNewPage, proxy, timeout, args, executablePath, maxWindowSize, headless, minBrowserContexts, incognito, proxyPerBrowserContext, userDataDir, userAgent };
|
|
17246
17249
|
let idx = args.findIndex((arg) => arg.toLowerCase().startsWith("--incoginto"));
|
|
17247
17250
|
if (idx >= 0) {
|
|
17248
17251
|
(0, import_utils15.logwarn)(`Please use options.incognito instead when launching new browser.`);
|
|
@@ -17258,12 +17261,20 @@ var LsdBrowserController = class _LsdBrowserController {
|
|
|
17258
17261
|
(0, import_utils15.logwarn)(`Please use options.userDataDir instead when launching new browser.`);
|
|
17259
17262
|
args.splice(idx, 1);
|
|
17260
17263
|
}
|
|
17264
|
+
idx = args.findIndex((arg) => arg.toLowerCase().startsWith("--start-maximized"));
|
|
17265
|
+
if (idx >= 0) {
|
|
17266
|
+
(0, import_utils15.logwarn)(`Please use options.maxWindowSize instead when launching new browser.`);
|
|
17267
|
+
args.splice(idx, 1);
|
|
17268
|
+
}
|
|
17261
17269
|
let lsdBrowser;
|
|
17262
17270
|
if (browserControllerType === "playwright") {
|
|
17263
17271
|
const launchOptions = { headless, timeout };
|
|
17264
17272
|
if (executablePath) {
|
|
17265
17273
|
launchOptions.executablePath = executablePath;
|
|
17266
17274
|
}
|
|
17275
|
+
if (maxWindowSize) {
|
|
17276
|
+
args.push("--start-maximized");
|
|
17277
|
+
}
|
|
17267
17278
|
if (proxy?.server && proxy.server !== "default") {
|
|
17268
17279
|
launchOptions.proxy = proxy;
|
|
17269
17280
|
} else if (proxyPerBrowserContext && browserType === "chromium" && this.#osPlatform.startsWith("win")) {
|
|
@@ -17288,12 +17299,13 @@ var LsdBrowserController = class _LsdBrowserController {
|
|
|
17288
17299
|
} else if (browserControllerType === "puppeteer") {
|
|
17289
17300
|
const product = this.#puppeteerProduct(browserType);
|
|
17290
17301
|
const launchOptions = { headless, timeout, product };
|
|
17291
|
-
if (actOptions.args?.includes("--start-maximized")) {
|
|
17292
|
-
launchOptions.defaultViewport = null;
|
|
17293
|
-
}
|
|
17294
17302
|
if (executablePath) {
|
|
17295
17303
|
launchOptions.executablePath = executablePath;
|
|
17296
17304
|
}
|
|
17305
|
+
if (maxWindowSize) {
|
|
17306
|
+
args.push("--start-maximized");
|
|
17307
|
+
launchOptions.defaultViewport = null;
|
|
17308
|
+
}
|
|
17297
17309
|
if (browserType === "chromium") {
|
|
17298
17310
|
if (incognito) {
|
|
17299
17311
|
args.push("--incognito");
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1279,6 +1279,7 @@ var PlaywrightBrowserContext = class extends EventEmitter2 {
|
|
|
1279
1279
|
return null;
|
|
1280
1280
|
}
|
|
1281
1281
|
const page = await this.#browserContext.newPage();
|
|
1282
|
+
await sleep(2e3);
|
|
1282
1283
|
const pageInfo = page.pageInfo;
|
|
1283
1284
|
if (!pageInfo) {
|
|
1284
1285
|
throw new Error(`Logic error in getPage`);
|
|
@@ -1461,7 +1462,7 @@ var PlaywrightBrowser = class extends EventEmitter3 {
|
|
|
1461
1462
|
return null;
|
|
1462
1463
|
}
|
|
1463
1464
|
const browserContextOptions = {};
|
|
1464
|
-
if (this.#options.
|
|
1465
|
+
if (this.#options.maxWindowSize) {
|
|
1465
1466
|
browserContextOptions.viewport = null;
|
|
1466
1467
|
}
|
|
1467
1468
|
const proxy = options?.proxy ? Object.assign({}, options.proxy) : this.#proxy;
|
|
@@ -2759,6 +2760,7 @@ var PuppeteerBrowserContext = class extends EventEmitter5 {
|
|
|
2759
2760
|
return null;
|
|
2760
2761
|
}
|
|
2761
2762
|
const page = await this.#browserContext.newPage();
|
|
2763
|
+
await sleep2(2e3);
|
|
2762
2764
|
const pageInfo = page.pageInfo;
|
|
2763
2765
|
if (!pageInfo) {
|
|
2764
2766
|
throw new Error(`Logic error in getPage`);
|
|
@@ -17214,6 +17216,7 @@ var LsdBrowserController = class _LsdBrowserController {
|
|
|
17214
17216
|
timeout = 3e4,
|
|
17215
17217
|
args = [],
|
|
17216
17218
|
executablePath = "",
|
|
17219
|
+
maxWindowSize = false,
|
|
17217
17220
|
headless = true,
|
|
17218
17221
|
minBrowserContexts = 1,
|
|
17219
17222
|
// incognito
|
|
@@ -17222,7 +17225,7 @@ var LsdBrowserController = class _LsdBrowserController {
|
|
|
17222
17225
|
userAgent = ""
|
|
17223
17226
|
} = options ? options : {};
|
|
17224
17227
|
const incognito = typeof options?.incognito === "boolean" ? options.incognito : browserControllerType === "puppeteer" ? false : true;
|
|
17225
|
-
const actOptions = { closeFreePagesIntervalSeconds, maxBrowserContextsPerBrowser, maxPagesPerBrowserContext, maxPageFreeSeconds, maxViewportOfNewPage, proxy, timeout, args, executablePath, headless, minBrowserContexts, incognito, proxyPerBrowserContext, userDataDir, userAgent };
|
|
17228
|
+
const actOptions = { closeFreePagesIntervalSeconds, maxBrowserContextsPerBrowser, maxPagesPerBrowserContext, maxPageFreeSeconds, maxViewportOfNewPage, proxy, timeout, args, executablePath, maxWindowSize, headless, minBrowserContexts, incognito, proxyPerBrowserContext, userDataDir, userAgent };
|
|
17226
17229
|
let idx = args.findIndex((arg) => arg.toLowerCase().startsWith("--incoginto"));
|
|
17227
17230
|
if (idx >= 0) {
|
|
17228
17231
|
logwarn6(`Please use options.incognito instead when launching new browser.`);
|
|
@@ -17238,12 +17241,20 @@ var LsdBrowserController = class _LsdBrowserController {
|
|
|
17238
17241
|
logwarn6(`Please use options.userDataDir instead when launching new browser.`);
|
|
17239
17242
|
args.splice(idx, 1);
|
|
17240
17243
|
}
|
|
17244
|
+
idx = args.findIndex((arg) => arg.toLowerCase().startsWith("--start-maximized"));
|
|
17245
|
+
if (idx >= 0) {
|
|
17246
|
+
logwarn6(`Please use options.maxWindowSize instead when launching new browser.`);
|
|
17247
|
+
args.splice(idx, 1);
|
|
17248
|
+
}
|
|
17241
17249
|
let lsdBrowser;
|
|
17242
17250
|
if (browserControllerType === "playwright") {
|
|
17243
17251
|
const launchOptions = { headless, timeout };
|
|
17244
17252
|
if (executablePath) {
|
|
17245
17253
|
launchOptions.executablePath = executablePath;
|
|
17246
17254
|
}
|
|
17255
|
+
if (maxWindowSize) {
|
|
17256
|
+
args.push("--start-maximized");
|
|
17257
|
+
}
|
|
17247
17258
|
if (proxy?.server && proxy.server !== "default") {
|
|
17248
17259
|
launchOptions.proxy = proxy;
|
|
17249
17260
|
} else if (proxyPerBrowserContext && browserType === "chromium" && this.#osPlatform.startsWith("win")) {
|
|
@@ -17268,12 +17279,13 @@ var LsdBrowserController = class _LsdBrowserController {
|
|
|
17268
17279
|
} else if (browserControllerType === "puppeteer") {
|
|
17269
17280
|
const product = this.#puppeteerProduct(browserType);
|
|
17270
17281
|
const launchOptions = { headless, timeout, product };
|
|
17271
|
-
if (actOptions.args?.includes("--start-maximized")) {
|
|
17272
|
-
launchOptions.defaultViewport = null;
|
|
17273
|
-
}
|
|
17274
17282
|
if (executablePath) {
|
|
17275
17283
|
launchOptions.executablePath = executablePath;
|
|
17276
17284
|
}
|
|
17285
|
+
if (maxWindowSize) {
|
|
17286
|
+
args.push("--start-maximized");
|
|
17287
|
+
launchOptions.defaultViewport = null;
|
|
17288
|
+
}
|
|
17277
17289
|
if (browserType === "chromium") {
|
|
17278
17290
|
if (incognito) {
|
|
17279
17291
|
args.push("--incognito");
|
package/package.json
CHANGED