single-file-cli 1.1.51 → 1.1.52
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.
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Source.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
/* global singlefile, require, exports */
|
|
24
|
+
/* global singlefile, require, exports, setTimeout */
|
|
25
25
|
|
|
26
26
|
const puppeteer = require("puppeteer-core");
|
|
27
27
|
const scripts = require("./common/scripts.js");
|
|
@@ -108,13 +108,13 @@ async function getPageData(browser, page, options) {
|
|
|
108
108
|
const injectedScript = await scripts.get(options);
|
|
109
109
|
await page.evaluateOnNewDocument(injectedScript);
|
|
110
110
|
if (options.browserDebug) {
|
|
111
|
-
await
|
|
111
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
112
112
|
}
|
|
113
113
|
await pageGoto(page, options);
|
|
114
114
|
try {
|
|
115
115
|
await page.evaluate(injectedScript);
|
|
116
116
|
if (options.browserWaitDelay) {
|
|
117
|
-
await
|
|
117
|
+
await new Promise(resolve => setTimeout(resolve, options.browserWaitDelay));
|
|
118
118
|
}
|
|
119
119
|
const pageData = await page.evaluate(async options => await singlefile.getPageData(options), options);
|
|
120
120
|
if (options.compressContent) {
|
package/back-ends/puppeteer.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Source.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
/* global singlefile, require, exports */
|
|
24
|
+
/* global singlefile, require, exports, setTimeout */
|
|
25
25
|
|
|
26
26
|
const puppeteer = require("puppeteer-core");
|
|
27
27
|
const scripts = require("./common/scripts.js");
|
|
@@ -49,7 +49,7 @@ exports.getPageData = async (options, page) => {
|
|
|
49
49
|
if (options.httpProxyServer) {
|
|
50
50
|
contextOptions.proxyServer = options.httpProxyServer;
|
|
51
51
|
}
|
|
52
|
-
context = await browser.
|
|
52
|
+
context = await browser.createBrowserContext(contextOptions);
|
|
53
53
|
page = await context.newPage();
|
|
54
54
|
}
|
|
55
55
|
await setPageOptions(page, options);
|
|
@@ -129,7 +129,7 @@ async function getPageData(context, page, options) {
|
|
|
129
129
|
const injectedScript = await scripts.get(options);
|
|
130
130
|
await page.evaluateOnNewDocument(injectedScript);
|
|
131
131
|
if (options.browserDebug) {
|
|
132
|
-
await
|
|
132
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
133
133
|
}
|
|
134
134
|
try {
|
|
135
135
|
await pageGoto(page, options);
|
|
@@ -148,7 +148,7 @@ async function getPageData(context, page, options) {
|
|
|
148
148
|
}
|
|
149
149
|
try {
|
|
150
150
|
if (options.browserWaitDelay) {
|
|
151
|
-
await
|
|
151
|
+
await new Promise(resolve => setTimeout(resolve, options.browserWaitDelay));
|
|
152
152
|
}
|
|
153
153
|
const pageData = await page.evaluate(async options => await singlefile.getPageData(options), options);
|
|
154
154
|
if (options.compressContent) {
|