unprint 0.19.6 → 0.19.7

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/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ //registry.npmjs.org/:_authToken=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
package/README.md CHANGED
@@ -306,6 +306,7 @@ Environment variables (optional, .env is supported):
306
306
  * `UNPRINT_KEY`: Key required for authentication
307
307
  * `UNPRINT_MEMORY_LIMIT`: Memory threshold at which to cycle the browser in MB
308
308
  * `UNPRINT_LOG_LEVEL`: Verbosity of the console output, `info` (default), `debug`, `silly`, `warn`, `error`
309
+ * `UNPRINT_HEADLESS`: Hide the browser window, `1` (yes, default) or `0` (no)
309
310
 
310
311
  #### Client
311
312
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.19.6",
3
+ "version": "0.19.7",
4
4
  "description": "Simplify common web scraping tasks while staying in control of the data.",
5
5
  "main": "src/app.js",
6
6
  "scripts": {
package/src/app.js CHANGED
@@ -1309,7 +1309,6 @@ async function closeAllBrowsers() {
1309
1309
 
1310
1310
  async function closeBrowser(client, options = {}) {
1311
1311
  if (options.client === null // this browser is single-use
1312
- || client.isRemote
1313
1312
  || (client.retired && client.active === 0)) { // this browser is retired to minimize garbage build-up
1314
1313
  // this browser won't be reused, browser close DOES NOT automatically close context https://github.com/microsoft/playwright/issues/15163
1315
1314
  await client.context.close();
package/src/server.js CHANGED
@@ -59,7 +59,7 @@ function closeSocket(socket, code, reason) {
59
59
 
60
60
  async function getClient() {
61
61
  const browser = await chromium.launchServer({
62
- headless: false,
62
+ headless: process.env.UNPRINT_HEADLESS !== '0',
63
63
  });
64
64
 
65
65
  const endpoint = browser.wsEndpoint();
package/tests/remote.js CHANGED
@@ -35,6 +35,12 @@ async function init() {
35
35
 
36
36
  console.log('control', res.control);
37
37
  console.log('form', form);
38
+
39
+ await unprint.browser('https://www.bing.com', {
40
+ useRemote: true,
41
+ });
42
+
43
+ await unprint.closeAllBrowsers();
38
44
  }
39
45
 
40
46
  init();