@letsscrapedata/controller 0.0.9 → 0.0.11
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 +6 -4
- package/dist/index.d.cts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +5 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -58,6 +58,7 @@ __export(src_exports, {
|
|
|
58
58
|
PuppeteerBrowserContext: () => PuppeteerBrowserContext,
|
|
59
59
|
PuppeteerElement: () => PuppeteerElement,
|
|
60
60
|
PuppeteerPage: () => PuppeteerPage,
|
|
61
|
+
controller: () => controller,
|
|
61
62
|
defaultProxy: () => defaultProxy
|
|
62
63
|
});
|
|
63
64
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -1265,7 +1266,7 @@ var PlaywrightBrowserContext = class extends import_node_events2.default {
|
|
|
1265
1266
|
return false;
|
|
1266
1267
|
}
|
|
1267
1268
|
}
|
|
1268
|
-
async getPage() {
|
|
1269
|
+
async getPage(always = false) {
|
|
1269
1270
|
if (!this.#browserContext) {
|
|
1270
1271
|
throw new Error("Invalid browserContext");
|
|
1271
1272
|
}
|
|
@@ -1280,7 +1281,7 @@ var PlaywrightBrowserContext = class extends import_node_events2.default {
|
|
|
1280
1281
|
this.#freeGettingLock();
|
|
1281
1282
|
return lsdPage;
|
|
1282
1283
|
}
|
|
1283
|
-
if (this.#lsdPages.length >= this.#maxPagesPerBrowserContext) {
|
|
1284
|
+
if (this.#lsdPages.length >= this.#maxPagesPerBrowserContext && !always) {
|
|
1284
1285
|
this.#freeGettingLock();
|
|
1285
1286
|
return null;
|
|
1286
1287
|
}
|
|
@@ -2731,7 +2732,7 @@ var PuppeteerBrowserContext = class extends import_node_events5.default {
|
|
|
2731
2732
|
return false;
|
|
2732
2733
|
}
|
|
2733
2734
|
}
|
|
2734
|
-
async getPage() {
|
|
2735
|
+
async getPage(always = false) {
|
|
2735
2736
|
if (!this.#browserContext) {
|
|
2736
2737
|
throw new Error("Invalid browserContext");
|
|
2737
2738
|
}
|
|
@@ -2749,7 +2750,7 @@ var PuppeteerBrowserContext = class extends import_node_events5.default {
|
|
|
2749
2750
|
this.#freeGettingLock();
|
|
2750
2751
|
return lsdPage;
|
|
2751
2752
|
}
|
|
2752
|
-
if (this.#lsdPages.length >= this.#maxPagesPerBrowserContext) {
|
|
2753
|
+
if (this.#lsdPages.length >= this.#maxPagesPerBrowserContext && !always) {
|
|
2753
2754
|
return null;
|
|
2754
2755
|
}
|
|
2755
2756
|
const page = await this.#browserContext.newPage();
|
|
@@ -17308,5 +17309,6 @@ var controller = new LsdBrowserController();
|
|
|
17308
17309
|
PuppeteerBrowserContext,
|
|
17309
17310
|
PuppeteerElement,
|
|
17310
17311
|
PuppeteerPage,
|
|
17312
|
+
controller,
|
|
17311
17313
|
defaultProxy
|
|
17312
17314
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -878,7 +878,7 @@ interface LsdBrowserContext extends EventEmitter {
|
|
|
878
878
|
* 获取一个page供执行TE(可能从空闲的page中获取,也可能新建一个page)
|
|
879
879
|
* * TBD:需要预留pageQuota给需要capName的TE使用
|
|
880
880
|
*/
|
|
881
|
-
getPage(): Promise<LsdPage | null>;
|
|
881
|
+
getPage(always?: boolean): Promise<LsdPage | null>;
|
|
882
882
|
/**
|
|
883
883
|
* 是否可以获取新page(现有空闲的或新建page)
|
|
884
884
|
* @param pageNum default 1,需要的pages数量
|
|
@@ -907,7 +907,7 @@ interface LsdBrowser extends EventEmitter {
|
|
|
907
907
|
version(): Promise<string>;
|
|
908
908
|
_origBrowserContexts(): AllBrowserContext[];
|
|
909
909
|
}
|
|
910
|
-
interface LsdBrowserController {
|
|
910
|
+
interface LsdBrowserController$1 {
|
|
911
911
|
launch(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options?: LsdLaunchOptions): Promise<LsdBrowser>;
|
|
912
912
|
connect(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options?: LsdConnectOptions): Promise<LsdBrowser>;
|
|
913
913
|
}
|
|
@@ -963,7 +963,7 @@ declare class PlaywrightBrowserContext extends EventEmitter implements LsdBrowse
|
|
|
963
963
|
browser(): LsdBrowser;
|
|
964
964
|
close(): Promise<boolean>;
|
|
965
965
|
closeFreePages(maxPageFreeSeconds?: number): Promise<boolean>;
|
|
966
|
-
getPage(): Promise<LsdPage | null>;
|
|
966
|
+
getPage(always?: boolean): Promise<LsdPage | null>;
|
|
967
967
|
hasNewPage(pageNum?: number): boolean;
|
|
968
968
|
id(): string;
|
|
969
969
|
isIncognito(): boolean;
|
|
@@ -1071,7 +1071,7 @@ declare class PuppeteerBrowserContext extends EventEmitter implements LsdBrowser
|
|
|
1071
1071
|
browser(): LsdBrowser;
|
|
1072
1072
|
close(): Promise<boolean>;
|
|
1073
1073
|
closeFreePages(maxPageFreeSeconds?: number): Promise<boolean>;
|
|
1074
|
-
getPage(): Promise<LsdPage | null>;
|
|
1074
|
+
getPage(always?: boolean): Promise<LsdPage | null>;
|
|
1075
1075
|
hasNewPage(pageNum?: number): boolean;
|
|
1076
1076
|
id(): string;
|
|
1077
1077
|
isIncognito(): boolean;
|
|
@@ -1227,4 +1227,12 @@ declare class CheerioElement implements LsdElement {
|
|
|
1227
1227
|
scrollIntoView(): Promise<boolean>;
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
-
|
|
1230
|
+
declare class LsdBrowserController implements LsdBrowserController$1 {
|
|
1231
|
+
#private;
|
|
1232
|
+
constructor();
|
|
1233
|
+
launch(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options: LsdLaunchOptions): Promise<LsdBrowser>;
|
|
1234
|
+
connect(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options: LsdConnectOptions): Promise<LsdBrowser>;
|
|
1235
|
+
}
|
|
1236
|
+
declare const controller: LsdBrowserController;
|
|
1237
|
+
|
|
1238
|
+
export { type AllBrowser, type AllBrowserContext, type AllFrame, type AllPage, type AllResponse, type BrowserControllerOptions, type BrowserControllerType, type BrowserCreationMethod, type BrowserManager, CheerioElement, type CheerioNode, CheerioPage, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightElement, PlaywrightPage, type Proxy, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ScreenshotOptions, type SelectOptions, type StateData, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, defaultProxy };
|
package/dist/index.d.ts
CHANGED
|
@@ -878,7 +878,7 @@ interface LsdBrowserContext extends EventEmitter {
|
|
|
878
878
|
* 获取一个page供执行TE(可能从空闲的page中获取,也可能新建一个page)
|
|
879
879
|
* * TBD:需要预留pageQuota给需要capName的TE使用
|
|
880
880
|
*/
|
|
881
|
-
getPage(): Promise<LsdPage | null>;
|
|
881
|
+
getPage(always?: boolean): Promise<LsdPage | null>;
|
|
882
882
|
/**
|
|
883
883
|
* 是否可以获取新page(现有空闲的或新建page)
|
|
884
884
|
* @param pageNum default 1,需要的pages数量
|
|
@@ -907,7 +907,7 @@ interface LsdBrowser extends EventEmitter {
|
|
|
907
907
|
version(): Promise<string>;
|
|
908
908
|
_origBrowserContexts(): AllBrowserContext[];
|
|
909
909
|
}
|
|
910
|
-
interface LsdBrowserController {
|
|
910
|
+
interface LsdBrowserController$1 {
|
|
911
911
|
launch(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options?: LsdLaunchOptions): Promise<LsdBrowser>;
|
|
912
912
|
connect(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options?: LsdConnectOptions): Promise<LsdBrowser>;
|
|
913
913
|
}
|
|
@@ -963,7 +963,7 @@ declare class PlaywrightBrowserContext extends EventEmitter implements LsdBrowse
|
|
|
963
963
|
browser(): LsdBrowser;
|
|
964
964
|
close(): Promise<boolean>;
|
|
965
965
|
closeFreePages(maxPageFreeSeconds?: number): Promise<boolean>;
|
|
966
|
-
getPage(): Promise<LsdPage | null>;
|
|
966
|
+
getPage(always?: boolean): Promise<LsdPage | null>;
|
|
967
967
|
hasNewPage(pageNum?: number): boolean;
|
|
968
968
|
id(): string;
|
|
969
969
|
isIncognito(): boolean;
|
|
@@ -1071,7 +1071,7 @@ declare class PuppeteerBrowserContext extends EventEmitter implements LsdBrowser
|
|
|
1071
1071
|
browser(): LsdBrowser;
|
|
1072
1072
|
close(): Promise<boolean>;
|
|
1073
1073
|
closeFreePages(maxPageFreeSeconds?: number): Promise<boolean>;
|
|
1074
|
-
getPage(): Promise<LsdPage | null>;
|
|
1074
|
+
getPage(always?: boolean): Promise<LsdPage | null>;
|
|
1075
1075
|
hasNewPage(pageNum?: number): boolean;
|
|
1076
1076
|
id(): string;
|
|
1077
1077
|
isIncognito(): boolean;
|
|
@@ -1227,4 +1227,12 @@ declare class CheerioElement implements LsdElement {
|
|
|
1227
1227
|
scrollIntoView(): Promise<boolean>;
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
-
|
|
1230
|
+
declare class LsdBrowserController implements LsdBrowserController$1 {
|
|
1231
|
+
#private;
|
|
1232
|
+
constructor();
|
|
1233
|
+
launch(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options: LsdLaunchOptions): Promise<LsdBrowser>;
|
|
1234
|
+
connect(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options: LsdConnectOptions): Promise<LsdBrowser>;
|
|
1235
|
+
}
|
|
1236
|
+
declare const controller: LsdBrowserController;
|
|
1237
|
+
|
|
1238
|
+
export { type AllBrowser, type AllBrowserContext, type AllFrame, type AllPage, type AllResponse, type BrowserControllerOptions, type BrowserControllerType, type BrowserCreationMethod, type BrowserManager, CheerioElement, type CheerioNode, CheerioPage, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightElement, PlaywrightPage, type Proxy, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ScreenshotOptions, type SelectOptions, type StateData, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, defaultProxy };
|
package/dist/index.js
CHANGED
|
@@ -1246,7 +1246,7 @@ var PlaywrightBrowserContext = class extends EventEmitter2 {
|
|
|
1246
1246
|
return false;
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
|
-
async getPage() {
|
|
1249
|
+
async getPage(always = false) {
|
|
1250
1250
|
if (!this.#browserContext) {
|
|
1251
1251
|
throw new Error("Invalid browserContext");
|
|
1252
1252
|
}
|
|
@@ -1261,7 +1261,7 @@ var PlaywrightBrowserContext = class extends EventEmitter2 {
|
|
|
1261
1261
|
this.#freeGettingLock();
|
|
1262
1262
|
return lsdPage;
|
|
1263
1263
|
}
|
|
1264
|
-
if (this.#lsdPages.length >= this.#maxPagesPerBrowserContext) {
|
|
1264
|
+
if (this.#lsdPages.length >= this.#maxPagesPerBrowserContext && !always) {
|
|
1265
1265
|
this.#freeGettingLock();
|
|
1266
1266
|
return null;
|
|
1267
1267
|
}
|
|
@@ -2712,7 +2712,7 @@ var PuppeteerBrowserContext = class extends EventEmitter5 {
|
|
|
2712
2712
|
return false;
|
|
2713
2713
|
}
|
|
2714
2714
|
}
|
|
2715
|
-
async getPage() {
|
|
2715
|
+
async getPage(always = false) {
|
|
2716
2716
|
if (!this.#browserContext) {
|
|
2717
2717
|
throw new Error("Invalid browserContext");
|
|
2718
2718
|
}
|
|
@@ -2730,7 +2730,7 @@ var PuppeteerBrowserContext = class extends EventEmitter5 {
|
|
|
2730
2730
|
this.#freeGettingLock();
|
|
2731
2731
|
return lsdPage;
|
|
2732
2732
|
}
|
|
2733
|
-
if (this.#lsdPages.length >= this.#maxPagesPerBrowserContext) {
|
|
2733
|
+
if (this.#lsdPages.length >= this.#maxPagesPerBrowserContext && !always) {
|
|
2734
2734
|
return null;
|
|
2735
2735
|
}
|
|
2736
2736
|
const page = await this.#browserContext.newPage();
|
|
@@ -17288,5 +17288,6 @@ export {
|
|
|
17288
17288
|
PuppeteerBrowserContext,
|
|
17289
17289
|
PuppeteerElement,
|
|
17290
17290
|
PuppeteerPage,
|
|
17291
|
+
controller,
|
|
17291
17292
|
defaultProxy
|
|
17292
17293
|
};
|
package/package.json
CHANGED