From 07ad31711f2898d311119eb8468bdab0cb809826 Mon Sep 17 00:00:00 2001 From: ye4241 Date: Tue, 10 Aug 2021 17:38:45 +0800 Subject: [PATCH 01/13] update puppeteer version; --- package-lock.json | 894 ++++++++++++++++++++++++++++++++++++++++++++-- package.json | 2 +- 2 files changed, 859 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index 55e40b4..82691ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,821 @@ { "name": "textnow", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "textnow", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "puppeteer": "^10.2.0", + "puppeteer-extra": "^3.1.18", + "puppeteer-extra-plugin-recaptcha": "^3.4.0", + "puppeteer-extra-plugin-stealth": "^2.7.8" + } + }, + "node_modules/@types/debug": { + "version": "4.1.5", + "resolved": "https://registry.nlark.com/@types/debug/download/@types/debug-4.1.5.tgz?cache=0&sync_timestamp=1621240863945&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fdebug%2Fdownload%2F%40types%2Fdebug-4.1.5.tgz", + "integrity": "sha1-sU76iFK3do2JiQZhPCP2iHE+As0=" + }, + "node_modules/@types/node": { + "version": "15.6.1", + "resolved": "https://registry.nlark.com/@types/node/download/@types/node-15.6.1.tgz?cache=0&sync_timestamp=1621901524629&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-15.6.1.tgz", + "integrity": "sha1-MtQzkNXGLFtuxIapvJxZVE3jmgg=" + }, + "node_modules/@types/puppeteer": { + "version": "5.4.3", + "resolved": "https://registry.nlark.com/@types/puppeteer/download/@types/puppeteer-5.4.3.tgz?cache=0&sync_timestamp=1621243798086&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fpuppeteer%2Fdownload%2F%40types%2Fpuppeteer-5.4.3.tgz", + "integrity": "sha1-zcqEqndR13RI2KR32/oK8fEUhfI=", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/yauzl": { + "version": "2.9.1", + "resolved": "https://registry.nlark.com/@types/yauzl/download/@types/yauzl-2.9.1.tgz?cache=0&sync_timestamp=1621244223552&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fyauzl%2Fdownload%2F%40types%2Fyauzl-2.9.1.tgz", + "integrity": "sha1-0Q9p+fUi7vPPmOMK+2hKHh7JI68=", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npm.taobao.org/agent-base/download/agent-base-6.0.2.tgz?cache=0&sync_timestamp=1603480011934&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fagent-base%2Fdownload%2Fagent-base-6.0.2.tgz", + "integrity": "sha1-Sf/1hXfP7j83F2/qtMIuAPhtf3c=", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npm.taobao.org/arr-union/download/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npm.taobao.org/at-least-node/download/at-least-node-1.0.0.tgz", + "integrity": "sha1-YCzUtG6EStTv/JKoARo8RuAjjcI=", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbalanced-match%2Fdownload%2Fbalanced-match-1.0.2.tgz", + "integrity": "sha1-6D46fj8wCzTLnYf2FfoMvzV2kO4=" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npm.taobao.org/base64-js/download/base64-js-1.5.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbase64-js%2Fdownload%2Fbase64-js-1.5.1.tgz", + "integrity": "sha1-GxtEAWClv3rUC2UPCVljSBkDkwo=" + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npm.taobao.org/bl/download/bl-4.1.0.tgz", + "integrity": "sha1-RRU1JkGCvsL7vIOmKrmM8R2fezo=", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.11.tgz", + "integrity": "sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0=", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npm.taobao.org/buffer/download/buffer-5.7.1.tgz?cache=0&sync_timestamp=1606098078312&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbuffer%2Fdownload%2Fbuffer-5.7.1.tgz", + "integrity": "sha1-umLnwTEzBTWCGXFghRqPZI6Z7tA=", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npm.taobao.org/buffer-crc32/download/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "engines": { + "node": "*" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npm.taobao.org/chownr/download/chownr-1.1.4.tgz", + "integrity": "sha1-b8nXtC0ypYNZYzdmbn0ICE2izGs=" + }, + "node_modules/clone-deep": { + "version": "0.2.4", + "resolved": "https://registry.npm.taobao.org/clone-deep/download/clone-deep-0.2.4.tgz", + "integrity": "sha1-TnPdCen7lxzDhnDF3O2cGJZIHMY=", + "dependencies": { + "for-own": "^0.1.3", + "is-plain-object": "^2.0.1", + "kind-of": "^3.0.2", + "lazy-cache": "^1.0.3", + "shallow-clone": "^0.1.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npm.taobao.org/concat-map/download/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npm.taobao.org/debug/download/debug-4.3.1.tgz?cache=0&sync_timestamp=1607566512593&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdebug%2Fdownload%2Fdebug-4.3.1.tgz", + "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-4.2.2.tgz", + "integrity": "sha1-RNLqNnm49NT/ujPwPYZfwee/SVU=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/devtools-protocol": { + "version": "0.0.901419", + "resolved": "https://registry.nlark.com/devtools-protocol/download/devtools-protocol-0.0.901419.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdevtools-protocol%2Fdownload%2Fdevtools-protocol-0.0.901419.tgz", + "integrity": "sha1-ebVFnEj+fhxVY8Ar1y+P7D4M680=" + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npm.taobao.org/end-of-stream/download/end-of-stream-1.4.4.tgz?cache=0&sync_timestamp=1569416272686&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fend-of-stream%2Fdownload%2Fend-of-stream-1.4.4.tgz", + "integrity": "sha1-WuZKX0UFe682JuwU2gyl5LJDHrA=", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npm.taobao.org/extract-zip/download/extract-zip-2.0.1.tgz", + "integrity": "sha1-Zj3KVv5G34kNXxMe9KBtIruLoTo=", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npm.taobao.org/fd-slicer/download/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npm.taobao.org/find-up/download/find-up-4.1.0.tgz", + "integrity": "sha1-l6/n1s3AvFkoWEt8jXsW6KmqXRk=", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/for-in": { + "version": "1.0.2", + "resolved": "https://registry.npm.taobao.org/for-in/download/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/for-own": { + "version": "0.1.5", + "resolved": "https://registry.npm.taobao.org/for-own/download/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dependencies": { + "for-in": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npm.taobao.org/fs-constants/download/fs-constants-1.0.0.tgz", + "integrity": "sha1-a+Dem+mYzhavivwkSXue6bfM2a0=" + }, + "node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.nlark.com/fs-extra/download/fs-extra-9.1.0.tgz?cache=0&sync_timestamp=1620079845472&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffs-extra%2Fdownload%2Ffs-extra-9.1.0.tgz", + "integrity": "sha1-WVRGDHZKjaIJS6NVS/g55rmnyG0=", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npm.taobao.org/fs.realpath/download/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npm.taobao.org/get-stream/download/get-stream-5.2.0.tgz?cache=0&sync_timestamp=1618462718162&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fget-stream%2Fdownload%2Fget-stream-5.2.0.tgz", + "integrity": "sha1-SWaheV7lrOZecGxLe+txJX1uItM=", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.nlark.com/glob/download/glob-7.1.7.tgz?cache=0&sync_timestamp=1620337498129&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fglob%2Fdownload%2Fglob-7.1.7.tgz", + "integrity": "sha1-Oxk+kjPwHULQs/eClLvutBj5SpA=", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.2.6.tgz", + "integrity": "sha1-/wQLKwhTsjw9MQJ1I3BvGIXXa+4=" + }, + "node_modules/https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npm.taobao.org/https-proxy-agent/download/https-proxy-agent-5.0.0.tgz?cache=0&sync_timestamp=1581106853117&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhttps-proxy-agent%2Fdownload%2Fhttps-proxy-agent-5.0.0.tgz", + "integrity": "sha1-4qkFQqu2inYuCghQ9sntrf2FBrI=", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npm.taobao.org/ieee754/download/ieee754-1.2.1.tgz?cache=0&sync_timestamp=1603838235461&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fieee754%2Fdownload%2Fieee754-1.2.1.tgz", + "integrity": "sha1-jrehCmP/8l0VpXsAFYbRd9Gw01I=" + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npm.taobao.org/inflight/download/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npm.taobao.org/inherits/download/inherits-2.0.4.tgz?cache=0&sync_timestamp=1560975547815&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Finherits%2Fdownload%2Finherits-2.0.4.tgz", + "integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=" + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npm.taobao.org/is-buffer/download/is-buffer-1.1.6.tgz?cache=0&sync_timestamp=1604432378894&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-buffer%2Fdownload%2Fis-buffer-1.1.6.tgz", + "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=" + }, + "node_modules/is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npm.taobao.org/is-extendable/download/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npm.taobao.org/is-plain-object/download/is-plain-object-2.0.4.tgz?cache=0&sync_timestamp=1599667316315&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-plain-object%2Fdownload%2Fis-plain-object-2.0.4.tgz", + "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npm.taobao.org/isobject/download/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npm.taobao.org/jsonfile/download/jsonfile-6.1.0.tgz?cache=0&sync_timestamp=1604161844511&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjsonfile%2Fdownload%2Fjsonfile-6.1.0.tgz", + "integrity": "sha1-vFWyY0eTxnnsZAMJTrE2mKbsCq4=", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npm.taobao.org/kind-of/download/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npm.taobao.org/lazy-cache/download/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npm.taobao.org/locate-path/download/locate-path-5.0.0.tgz", + "integrity": "sha1-Gvujlq/WdqbUJQTQpno6frn2KqA=", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/merge-deep": { + "version": "3.0.3", + "resolved": "https://registry.npm.taobao.org/merge-deep/download/merge-deep-3.0.3.tgz?cache=0&sync_timestamp=1610379479312&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmerge-deep%2Fdownload%2Fmerge-deep-3.0.3.tgz", + "integrity": "sha1-Gisq6SbaiyrpOgrBXZDNGSJ2YAM=", + "dependencies": { + "arr-union": "^3.1.0", + "clone-deep": "^0.2.4", + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npm.taobao.org/minimatch/download/minimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.nlark.com/minimist/download/minimist-1.2.5.tgz", + "integrity": "sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI=" + }, + "node_modules/mixin-object": { + "version": "2.0.1", + "resolved": "https://registry.npm.taobao.org/mixin-object/download/mixin-object-2.0.1.tgz", + "integrity": "sha1-T7lJRB2rGCVA8f4DW6YOGUel5X4=", + "dependencies": { + "for-in": "^0.1.3", + "is-extendable": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mixin-object/node_modules/for-in": { + "version": "0.1.8", + "resolved": "https://registry.npm.taobao.org/for-in/download/for-in-0.1.8.tgz", + "integrity": "sha1-2Hc5COMSVhCZUrH9ubP6hn0ndeE=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.nlark.com/mkdirp/download/mkdirp-0.5.5.tgz", + "integrity": "sha1-2Rzv1i0UNsoPQWIOJRKI1CAJne8=", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz?cache=0&sync_timestamp=1607433816745&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=" + }, + "node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npm.taobao.org/node-fetch/download/node-fetch-2.6.1.tgz?cache=0&sync_timestamp=1599309667528&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-fetch%2Fdownload%2Fnode-fetch-2.6.1.tgz", + "integrity": "sha1-BFvTI2Mfdu0uK1VXM5RBa2OaAFI=", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npm.taobao.org/once/download/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npm.taobao.org/p-limit/download/p-limit-2.3.0.tgz", + "integrity": "sha1-PdM8ZHohT9//2DWTPrCG2g3CHbE=", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npm.taobao.org/p-locate/download/p-locate-4.1.0.tgz?cache=0&sync_timestamp=1597081508945&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fp-locate%2Fdownload%2Fp-locate-4.1.0.tgz", + "integrity": "sha1-o0KLtwiLOmApL2aRkni3wpetTwc=", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npm.taobao.org/p-try/download/p-try-2.2.0.tgz", + "integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=", + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/path-exists/download/path-exists-4.0.0.tgz", + "integrity": "sha1-UTvb4tO5XXdi6METfvoZXGxhtbM=", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npm.taobao.org/path-is-absolute/download/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npm.taobao.org/pend/download/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npm.taobao.org/pkg-dir/download/pkg-dir-4.2.0.tgz?cache=0&sync_timestamp=1602858985920&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpkg-dir%2Fdownload%2Fpkg-dir-4.2.0.tgz", + "integrity": "sha1-8JkTPfft5CLoHR2ESCcO6z5CYfM=", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/progress": { + "version": "2.0.1", + "resolved": "https://registry.npm.taobao.org/progress/download/progress-2.0.1.tgz", + "integrity": "sha1-ySQhaTQrHCnSdYiclXNGIbGVLjE=", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npm.taobao.org/proxy-from-env/download/proxy-from-env-1.1.0.tgz", + "integrity": "sha1-4QLxbKNVQkhldV0sno6k8k1Yw+I=" + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/pump/download/pump-3.0.0.tgz", + "integrity": "sha1-tKIRaBW94vTh6mAjVOjHVWUQemQ=", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/puppeteer": { + "version": "10.2.0", + "resolved": "https://registry.nlark.com/puppeteer/download/puppeteer-10.2.0.tgz?cache=0&sync_timestamp=1628081917525&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpuppeteer%2Fdownload%2Fpuppeteer-10.2.0.tgz", + "integrity": "sha1-fY1/2pHhmnz9VphuAnVEjmNRhJ4=", + "dependencies": { + "debug": "4.3.1", + "devtools-protocol": "0.0.901419", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.0", + "node-fetch": "2.6.1", + "pkg-dir": "4.2.0", + "progress": "2.0.1", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.0.0", + "unbzip2-stream": "1.3.3", + "ws": "7.4.6" + }, + "engines": { + "node": ">=10.18.1" + } + }, + "node_modules/puppeteer-extra": { + "version": "3.1.18", + "resolved": "https://registry.npm.taobao.org/puppeteer-extra/download/puppeteer-extra-3.1.18.tgz", + "integrity": "sha1-QmkBjlX37mJ4jRPj6z2J6EKj1I4=", + "dependencies": { + "@types/debug": "^4.1.0", + "@types/puppeteer": "5.4.3", + "debug": "^4.1.1", + "deepmerge": "^4.2.2" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "puppeteer": "*" + } + }, + "node_modules/puppeteer-extra-plugin": { + "version": "3.1.9", + "resolved": "https://registry.npm.taobao.org/puppeteer-extra-plugin/download/puppeteer-extra-plugin-3.1.9.tgz", + "integrity": "sha1-DI4+F+4B5jEbvjK2loZOo2mb3t8=", + "dependencies": { + "@types/debug": "^4.1.0", + "debug": "^4.1.1", + "merge-deep": "^3.0.1" + }, + "engines": { + "node": ">=9.11.2" + }, + "peerDependencies": { + "puppeteer-extra": "*" + } + }, + "node_modules/puppeteer-extra-plugin-recaptcha": { + "version": "3.4.0", + "resolved": "https://registry.nlark.com/puppeteer-extra-plugin-recaptcha/download/puppeteer-extra-plugin-recaptcha-3.4.0.tgz", + "integrity": "sha1-rhiN7DsDM4K+ECree4REUtJ1nRk=", + "dependencies": { + "debug": "^4.1.1", + "merge-deep": "^3.0.2", + "puppeteer-extra-plugin": "^3.1.9" + }, + "engines": { + "node": ">=9.11.2" + }, + "peerDependencies": { + "puppeteer-extra": "*" + } + }, + "node_modules/puppeteer-extra-plugin-stealth": { + "version": "2.7.8", + "resolved": "https://registry.nlark.com/puppeteer-extra-plugin-stealth/download/puppeteer-extra-plugin-stealth-2.7.8.tgz", + "integrity": "sha1-dCTJVeJTUaVQJHNEdwWcmIZHBHw=", + "dependencies": { + "debug": "^4.1.1", + "puppeteer-extra-plugin": "^3.1.9", + "puppeteer-extra-plugin-user-preferences": "^2.2.12" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/puppeteer-extra-plugin-user-data-dir": { + "version": "2.2.12", + "resolved": "https://registry.npm.taobao.org/puppeteer-extra-plugin-user-data-dir/download/puppeteer-extra-plugin-user-data-dir-2.2.12.tgz", + "integrity": "sha1-avf2WdiVxd+0e7rw58mfWISfiUQ=", + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^9.1.0", + "puppeteer-extra-plugin": "^3.1.9" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/puppeteer-extra-plugin-user-preferences": { + "version": "2.2.12", + "resolved": "https://registry.npm.taobao.org/puppeteer-extra-plugin-user-preferences/download/puppeteer-extra-plugin-user-preferences-2.2.12.tgz", + "integrity": "sha1-xw2hnD42OA0Oh3NgFoP5U+p6vBc=", + "dependencies": { + "debug": "^4.1.1", + "deepmerge": "^4.2.2", + "puppeteer-extra-plugin": "^3.1.9", + "puppeteer-extra-plugin-user-data-dir": "^2.2.12" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-3.6.0.tgz", + "integrity": "sha1-M3u9o63AcGvT4CRCaihtS0sskZg=", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npm.taobao.org/rimraf/download/rimraf-3.0.2.tgz?cache=0&sync_timestamp=1581229865753&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Frimraf%2Fdownload%2Frimraf-3.0.2.tgz", + "integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.2.1.tgz", + "integrity": "sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY=" + }, + "node_modules/shallow-clone": { + "version": "0.1.2", + "resolved": "https://registry.npm.taobao.org/shallow-clone/download/shallow-clone-0.1.2.tgz", + "integrity": "sha1-WQnodLp3EG1zrEFM/sH/yofZcGA=", + "dependencies": { + "is-extendable": "^0.1.1", + "kind-of": "^2.0.1", + "lazy-cache": "^0.2.3", + "mixin-object": "^2.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shallow-clone/node_modules/kind-of": { + "version": "2.0.1", + "resolved": "https://registry.npm.taobao.org/kind-of/download/kind-of-2.0.1.tgz", + "integrity": "sha1-AY7HpM5+OobLkUG+UZ0kyPqpgbU=", + "dependencies": { + "is-buffer": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shallow-clone/node_modules/lazy-cache": { + "version": "0.2.7", + "resolved": "https://registry.npm.taobao.org/lazy-cache/download/lazy-cache-0.2.7.tgz", + "integrity": "sha1-f+3fLctu23fRHvHRF6tf/fCrG2U=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npm.taobao.org/string_decoder/download/string_decoder-1.3.0.tgz?cache=0&sync_timestamp=1565170823020&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring_decoder%2Fdownload%2Fstring_decoder-1.3.0.tgz", + "integrity": "sha1-QvEUWUpGzxqOMLCoT1bHjD7awh4=", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/tar-fs": { + "version": "2.0.0", + "resolved": "https://registry.npm.taobao.org/tar-fs/download/tar-fs-2.0.0.tgz", + "integrity": "sha1-Z3cA/AyLM3p4vuNiP9wjXyHXr60=", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp": "^0.5.1", + "pump": "^3.0.0", + "tar-stream": "^2.0.0" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npm.taobao.org/tar-stream/download/tar-stream-2.2.0.tgz", + "integrity": "sha1-rK2EwoQTawYNw/qmRHSqmuvXcoc=", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npm.taobao.org/through/download/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "node_modules/unbzip2-stream": { + "version": "1.3.3", + "resolved": "https://registry.npm.taobao.org/unbzip2-stream/download/unbzip2-stream-1.3.3.tgz", + "integrity": "sha1-0VbSBeZw2NjDk+HALr1QZCKHP2o=", + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npm.taobao.org/universalify/download/universalify-2.0.0.tgz", + "integrity": "sha1-daSYTv7cSwiXXFrrc/Uw0C3yVxc=", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npm.taobao.org/util-deprecate/download/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/wrappy/download/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "node_modules/ws": { + "version": "7.4.6", + "resolved": "https://registry.nlark.com/ws/download/ws-7.4.6.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fws%2Fdownload%2Fws-7.4.6.tgz", + "integrity": "sha1-VlTKjs3u5HwzqaS/bSjivimAN3w=", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npm.taobao.org/yauzl/download/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + } + }, "dependencies": { "@types/debug": { "version": "4.1.5", @@ -128,9 +941,9 @@ "integrity": "sha1-RNLqNnm49NT/ujPwPYZfwee/SVU=" }, "devtools-protocol": { - "version": "0.0.869402", - "resolved": "https://registry.nlark.com/devtools-protocol/download/devtools-protocol-0.0.869402.tgz?cache=0&sync_timestamp=1622099877704&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdevtools-protocol%2Fdownload%2Fdevtools-protocol-0.0.869402.tgz", - "integrity": "sha1-A63nAXYXQuQ65N5dwYi82A8VbY0=" + "version": "0.0.901419", + "resolved": "https://registry.nlark.com/devtools-protocol/download/devtools-protocol-0.0.901419.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdevtools-protocol%2Fdownload%2Fdevtools-protocol-0.0.901419.tgz", + "integrity": "sha1-ebVFnEj+fhxVY8Ar1y+P7D4M680=" }, "end-of-stream": { "version": "1.4.4", @@ -327,6 +1140,11 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.nlark.com/minimist/download/minimist-1.2.5.tgz", + "integrity": "sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI=" + }, "mixin-object": { "version": "2.0.1", "resolved": "https://registry.npm.taobao.org/mixin-object/download/mixin-object-2.0.1.tgz", @@ -343,10 +1161,13 @@ } } }, - "mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npm.taobao.org/mkdirp-classic/download/mkdirp-classic-0.5.3.tgz?cache=0&sync_timestamp=1588588077613&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmkdirp-classic%2Fdownload%2Fmkdirp-classic-0.5.3.tgz", - "integrity": "sha1-+hDJEVzG2IZb4iG6R+6b7XhgERM=" + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.nlark.com/mkdirp/download/mkdirp-0.5.5.tgz", + "integrity": "sha1-2Rzv1i0UNsoPQWIOJRKI1CAJne8=", + "requires": { + "minimist": "^1.2.5" + } }, "ms": { "version": "2.1.2", @@ -411,9 +1232,9 @@ } }, "progress": { - "version": "2.0.3", - "resolved": "https://registry.npm.taobao.org/progress/download/progress-2.0.3.tgz", - "integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=" + "version": "2.0.1", + "resolved": "https://registry.npm.taobao.org/progress/download/progress-2.0.1.tgz", + "integrity": "sha1-ySQhaTQrHCnSdYiclXNGIbGVLjE=" }, "proxy-from-env": { "version": "1.1.0", @@ -430,22 +1251,22 @@ } }, "puppeteer": { - "version": "9.1.1", - "resolved": "https://registry.nlark.com/puppeteer/download/puppeteer-9.1.1.tgz", - "integrity": "sha1-90t/rPhoh+/Wxrn6u3uq5v3OASw=", - "requires": { - "debug": "^4.1.0", - "devtools-protocol": "0.0.869402", - "extract-zip": "^2.0.0", - "https-proxy-agent": "^5.0.0", - "node-fetch": "^2.6.1", - "pkg-dir": "^4.2.0", - "progress": "^2.0.1", - "proxy-from-env": "^1.1.0", - "rimraf": "^3.0.2", - "tar-fs": "^2.0.0", - "unbzip2-stream": "^1.3.3", - "ws": "^7.2.3" + "version": "10.2.0", + "resolved": "https://registry.nlark.com/puppeteer/download/puppeteer-10.2.0.tgz?cache=0&sync_timestamp=1628081917525&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpuppeteer%2Fdownload%2Fpuppeteer-10.2.0.tgz", + "integrity": "sha1-fY1/2pHhmnz9VphuAnVEjmNRhJ4=", + "requires": { + "debug": "4.3.1", + "devtools-protocol": "0.0.901419", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.0", + "node-fetch": "2.6.1", + "pkg-dir": "4.2.0", + "progress": "2.0.1", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.0.0", + "unbzip2-stream": "1.3.3", + "ws": "7.4.6" } }, "puppeteer-extra": { @@ -568,14 +1389,14 @@ } }, "tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npm.taobao.org/tar-fs/download/tar-fs-2.1.1.tgz", - "integrity": "sha1-SJoVq4Xx8L76uzcLfeT561y+h4Q=", + "version": "2.0.0", + "resolved": "https://registry.npm.taobao.org/tar-fs/download/tar-fs-2.0.0.tgz", + "integrity": "sha1-Z3cA/AyLM3p4vuNiP9wjXyHXr60=", "requires": { "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", + "mkdirp": "^0.5.1", "pump": "^3.0.0", - "tar-stream": "^2.1.4" + "tar-stream": "^2.0.0" } }, "tar-stream": { @@ -596,9 +1417,9 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "unbzip2-stream": { - "version": "1.4.3", - "resolved": "https://registry.npm.taobao.org/unbzip2-stream/download/unbzip2-stream-1.4.3.tgz", - "integrity": "sha1-sNoExDcTEd93HNwhXofyEwmRrOc=", + "version": "1.3.3", + "resolved": "https://registry.npm.taobao.org/unbzip2-stream/download/unbzip2-stream-1.3.3.tgz", + "integrity": "sha1-0VbSBeZw2NjDk+HALr1QZCKHP2o=", "requires": { "buffer": "^5.2.1", "through": "^2.3.8" @@ -622,7 +1443,8 @@ "ws": { "version": "7.4.6", "resolved": "https://registry.nlark.com/ws/download/ws-7.4.6.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fws%2Fdownload%2Fws-7.4.6.tgz", - "integrity": "sha1-VlTKjs3u5HwzqaS/bSjivimAN3w=" + "integrity": "sha1-VlTKjs3u5HwzqaS/bSjivimAN3w=", + "requires": {} }, "yauzl": { "version": "2.10.0", diff --git a/package.json b/package.json index 6bb52fb..05698fc 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "author": "", "license": "ISC", "dependencies": { - "puppeteer": "^9.1.1", + "puppeteer": "^10.2.0", "puppeteer-extra": "^3.1.18", "puppeteer-extra-plugin-recaptcha": "^3.4.0", "puppeteer-extra-plugin-stealth": "^2.7.8" From 169bd22948625f9f40088f0e2af36f5288cb7b17 Mon Sep 17 00:00:00 2001 From: ye4241 Date: Sat, 14 Aug 2021 03:01:20 +0800 Subject: [PATCH 02/13] add adblocker for fast loading textnow website; --- index.js | 2 + package-lock.json | 388 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 391 insertions(+) diff --git a/index.js b/index.js index 1933246..ea42805 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,7 @@ const actionFunc = async ( const puppeteer = require('puppeteer-extra'); const recaptchaPlugin = require('puppeteer-extra-plugin-recaptcha'); const stealthPlugin = require('puppeteer-extra-plugin-stealth'); + const adblockerPlugin = require('puppeteer-extra-plugin-adblocker'); const textNowHelper = require('./utils/helper'); let browser = null; @@ -33,6 +34,7 @@ const actionFunc = async ( }), ); } + puppeteer.use(adblockerPlugin()); browser = await puppeteer.launch({ headless: true, diff --git a/package-lock.json b/package-lock.json index 82691ac..e980312 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,15 +11,121 @@ "dependencies": { "puppeteer": "^10.2.0", "puppeteer-extra": "^3.1.18", + "puppeteer-extra-plugin-adblocker": "^2.11.11", "puppeteer-extra-plugin-recaptcha": "^3.4.0", "puppeteer-extra-plugin-stealth": "^2.7.8" } }, + "node_modules/@cliqz/adblocker": { + "version": "1.22.4", + "resolved": "https://registry.nlark.com/@cliqz/adblocker/download/@cliqz/adblocker-1.22.4.tgz", + "integrity": "sha1-g1vpGPTAi4SbaO/aXgF4fxBBrUo=", + "dependencies": { + "@cliqz/adblocker-content": "^1.22.4", + "@cliqz/adblocker-extended-selectors": "^1.22.4", + "@remusao/guess-url-type": "^1.1.2", + "@remusao/small": "^1.1.2", + "@remusao/smaz": "^1.7.1", + "@types/chrome": "^0.0.153", + "@types/firefox-webext-browser": "^82.0.0", + "tldts-experimental": "^5.6.21" + } + }, + "node_modules/@cliqz/adblocker-content": { + "version": "1.22.4", + "resolved": "https://registry.nlark.com/@cliqz/adblocker-content/download/@cliqz/adblocker-content-1.22.4.tgz", + "integrity": "sha1-RC9NnPXVhU2Xg1U/e6pRYslcZu0=", + "dependencies": { + "@cliqz/adblocker-extended-selectors": "^1.22.4" + } + }, + "node_modules/@cliqz/adblocker-extended-selectors": { + "version": "1.22.4", + "resolved": "https://registry.nlark.com/@cliqz/adblocker-extended-selectors/download/@cliqz/adblocker-extended-selectors-1.22.4.tgz", + "integrity": "sha1-QGkTY1OpXLIpHX25lR6k6FwwPiw=" + }, + "node_modules/@cliqz/adblocker/node_modules/@types/chrome": { + "version": "0.0.153", + "resolved": "https://registry.nlark.com/@types/chrome/download/@types/chrome-0.0.153.tgz", + "integrity": "sha1-bDAJ63vh0Pus6CvhWRIv2Z5KZGU=", + "dependencies": { + "@types/filesystem": "*", + "@types/har-format": "*" + } + }, + "node_modules/@remusao/guess-url-type": { + "version": "1.2.1", + "resolved": "https://registry.nlark.com/@remusao/guess-url-type/download/@remusao/guess-url-type-1.2.1.tgz", + "integrity": "sha1-s+fDKr35jQ+0+TzGfK1YC1/kulc=" + }, + "node_modules/@remusao/small": { + "version": "1.2.1", + "resolved": "https://registry.nlark.com/@remusao/small/download/@remusao/small-1.2.1.tgz", + "integrity": "sha1-Y7/kVIgyKJ+UrIaKDDBZcMmg5fk=" + }, + "node_modules/@remusao/smaz": { + "version": "1.9.1", + "resolved": "https://registry.nlark.com/@remusao/smaz/download/@remusao/smaz-1.9.1.tgz", + "integrity": "sha1-ormwRThfgeFhWmjZMrfMiwTJ240=", + "dependencies": { + "@remusao/smaz-compress": "^1.9.1", + "@remusao/smaz-decompress": "^1.9.1" + } + }, + "node_modules/@remusao/smaz-compress": { + "version": "1.9.1", + "resolved": "https://registry.nlark.com/@remusao/smaz-compress/download/@remusao/smaz-compress-1.9.1.tgz", + "integrity": "sha1-/HXq+bysLVi8TD1RgYOny5YS0nU=", + "dependencies": { + "@remusao/trie": "^1.4.1" + } + }, + "node_modules/@remusao/smaz-decompress": { + "version": "1.9.1", + "resolved": "https://registry.nlark.com/@remusao/smaz-decompress/download/@remusao/smaz-decompress-1.9.1.tgz", + "integrity": "sha1-gJT5l+j7WRpnjNqc8IwgnIJeuls=" + }, + "node_modules/@remusao/trie": { + "version": "1.4.1", + "resolved": "https://registry.nlark.com/@remusao/trie/download/@remusao/trie-1.4.1.tgz", + "integrity": "sha1-dV0J+KAHR2M05hH0Jxmy1YHwByA=" + }, + "node_modules/@types/chrome": { + "version": "0.0.91", + "resolved": "https://registry.nlark.com/@types/chrome/download/@types/chrome-0.0.91.tgz", + "integrity": "sha1-SzmW9V80QFfmpnfINmqpgIDG44A=", + "dependencies": { + "@types/filesystem": "*" + } + }, "node_modules/@types/debug": { "version": "4.1.5", "resolved": "https://registry.nlark.com/@types/debug/download/@types/debug-4.1.5.tgz?cache=0&sync_timestamp=1621240863945&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fdebug%2Fdownload%2F%40types%2Fdebug-4.1.5.tgz", "integrity": "sha1-sU76iFK3do2JiQZhPCP2iHE+As0=" }, + "node_modules/@types/filesystem": { + "version": "0.0.32", + "resolved": "https://registry.nlark.com/@types/filesystem/download/@types/filesystem-0.0.32.tgz", + "integrity": "sha1-MH33zAhKIpPDwaMRUbF4Bj4Kjt8=", + "dependencies": { + "@types/filewriter": "*" + } + }, + "node_modules/@types/filewriter": { + "version": "0.0.29", + "resolved": "https://registry.nlark.com/@types/filewriter/download/@types/filewriter-0.0.29.tgz", + "integrity": "sha1-pIeV7K35V/bA0Q4MNK+GwJj6W+4=" + }, + "node_modules/@types/firefox-webext-browser": { + "version": "82.0.1", + "resolved": "https://registry.nlark.com/@types/firefox-webext-browser/download/@types/firefox-webext-browser-82.0.1.tgz", + "integrity": "sha1-GX3sHRdbCZ642skunJyaVIKl3Yo=" + }, + "node_modules/@types/har-format": { + "version": "1.2.7", + "resolved": "https://registry.nlark.com/@types/har-format/download/@types/har-format-1.2.7.tgz", + "integrity": "sha1-3r/jY3jybE/Cq8od+Z8AqP+U/Sk=" + }, "node_modules/@types/node": { "version": "15.6.1", "resolved": "https://registry.nlark.com/@types/node/download/@types/node-15.6.1.tgz?cache=0&sync_timestamp=1621901524629&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-15.6.1.tgz", @@ -610,6 +716,89 @@ "puppeteer-extra": "*" } }, + "node_modules/puppeteer-extra-plugin-adblocker": { + "version": "2.11.11", + "resolved": "https://registry.nlark.com/puppeteer-extra-plugin-adblocker/download/puppeteer-extra-plugin-adblocker-2.11.11.tgz", + "integrity": "sha1-oBtbrE+noc5rlJIwahvJZJ4iZVw=", + "dependencies": { + "@cliqz/adblocker-puppeteer": "1.18.7", + "@types/chrome": "0.0.91", + "debug": "^4.1.1", + "node-fetch": "^2.6.0", + "puppeteer-extra-plugin": "^3.1.9" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "puppeteer-extra": "*" + } + }, + "node_modules/puppeteer-extra-plugin-adblocker/node_modules/@cliqz/adblocker-puppeteer": { + "version": "1.18.7", + "resolved": "https://registry.nlark.com/@cliqz/adblocker-puppeteer/download/@cliqz/adblocker-puppeteer-1.18.7.tgz", + "integrity": "sha1-8ZZFpsepi5Q0gNscmpaAyX8dGf4=", + "dependencies": { + "@cliqz/adblocker": "^1.18.7", + "@cliqz/adblocker-content": "^1.18.7", + "tldts-experimental": "^5.6.21" + }, + "peerDependencies": { + "@types/puppeteer": "5.x", + "puppeteer": "5.x" + } + }, + "node_modules/puppeteer-extra-plugin-adblocker/node_modules/agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npm.taobao.org/agent-base/download/agent-base-5.1.1.tgz?cache=0&sync_timestamp=1603480041218&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fagent-base%2Fdownload%2Fagent-base-5.1.1.tgz", + "integrity": "sha1-6Ps/JClZ20TWO+Zl23qOc5U3oyw=", + "peer": true, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/puppeteer-extra-plugin-adblocker/node_modules/devtools-protocol": { + "version": "0.0.818844", + "resolved": "https://registry.nlark.com/devtools-protocol/download/devtools-protocol-0.0.818844.tgz?cache=0&sync_timestamp=1628842777079&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdevtools-protocol%2Fdownload%2Fdevtools-protocol-0.0.818844.tgz", + "integrity": "sha1-0ZRyeOyFtT5MjKWY9geij6eFup4=", + "peer": true + }, + "node_modules/puppeteer-extra-plugin-adblocker/node_modules/https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/https-proxy-agent/download/https-proxy-agent-4.0.0.tgz", + "integrity": "sha1-cCtx+1UgoTKmbeH2dUHZ5iFU2Cs=", + "peer": true, + "dependencies": { + "agent-base": "5", + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/puppeteer-extra-plugin-adblocker/node_modules/puppeteer": { + "version": "5.5.0", + "resolved": "https://registry.nlark.com/puppeteer/download/puppeteer-5.5.0.tgz?cache=0&sync_timestamp=1628081917525&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpuppeteer%2Fdownload%2Fpuppeteer-5.5.0.tgz", + "integrity": "sha1-Mxp+3SEsoGtKVWFWQ19Yy64IrwA=", + "peer": true, + "dependencies": { + "debug": "^4.1.0", + "devtools-protocol": "0.0.818844", + "extract-zip": "^2.0.0", + "https-proxy-agent": "^4.0.0", + "node-fetch": "^2.6.1", + "pkg-dir": "^4.2.0", + "progress": "^2.0.1", + "proxy-from-env": "^1.0.0", + "rimraf": "^3.0.2", + "tar-fs": "^2.0.0", + "unbzip2-stream": "^1.3.3", + "ws": "^7.2.3" + }, + "engines": { + "node": ">=10.18.1" + } + }, "node_modules/puppeteer-extra-plugin-recaptcha": { "version": "3.4.0", "resolved": "https://registry.nlark.com/puppeteer-extra-plugin-recaptcha/download/puppeteer-extra-plugin-recaptcha-3.4.0.tgz", @@ -767,6 +956,19 @@ "resolved": "https://registry.npm.taobao.org/through/download/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, + "node_modules/tldts-core": { + "version": "5.7.40", + "resolved": "https://registry.nlark.com/tldts-core/download/tldts-core-5.7.40.tgz", + "integrity": "sha1-bghPv/J67XttCQulYzoE2canwEs=" + }, + "node_modules/tldts-experimental": { + "version": "5.7.40", + "resolved": "https://registry.nlark.com/tldts-experimental/download/tldts-experimental-5.7.40.tgz", + "integrity": "sha1-TN5pKX7E2Fr1RTIoOqkpXvB7Ilg=", + "dependencies": { + "tldts-core": "^5.7.40" + } + }, "node_modules/unbzip2-stream": { "version": "1.3.3", "resolved": "https://registry.npm.taobao.org/unbzip2-stream/download/unbzip2-stream-1.3.3.tgz", @@ -817,11 +1019,118 @@ } }, "dependencies": { + "@cliqz/adblocker": { + "version": "1.22.4", + "resolved": "https://registry.nlark.com/@cliqz/adblocker/download/@cliqz/adblocker-1.22.4.tgz", + "integrity": "sha1-g1vpGPTAi4SbaO/aXgF4fxBBrUo=", + "requires": { + "@cliqz/adblocker-content": "^1.22.4", + "@cliqz/adblocker-extended-selectors": "^1.22.4", + "@remusao/guess-url-type": "^1.1.2", + "@remusao/small": "^1.1.2", + "@remusao/smaz": "^1.7.1", + "@types/chrome": "^0.0.153", + "@types/firefox-webext-browser": "^82.0.0", + "tldts-experimental": "^5.6.21" + }, + "dependencies": { + "@types/chrome": { + "version": "0.0.153", + "resolved": "https://registry.nlark.com/@types/chrome/download/@types/chrome-0.0.153.tgz", + "integrity": "sha1-bDAJ63vh0Pus6CvhWRIv2Z5KZGU=", + "requires": { + "@types/filesystem": "*", + "@types/har-format": "*" + } + } + } + }, + "@cliqz/adblocker-content": { + "version": "1.22.4", + "resolved": "https://registry.nlark.com/@cliqz/adblocker-content/download/@cliqz/adblocker-content-1.22.4.tgz", + "integrity": "sha1-RC9NnPXVhU2Xg1U/e6pRYslcZu0=", + "requires": { + "@cliqz/adblocker-extended-selectors": "^1.22.4" + } + }, + "@cliqz/adblocker-extended-selectors": { + "version": "1.22.4", + "resolved": "https://registry.nlark.com/@cliqz/adblocker-extended-selectors/download/@cliqz/adblocker-extended-selectors-1.22.4.tgz", + "integrity": "sha1-QGkTY1OpXLIpHX25lR6k6FwwPiw=" + }, + "@remusao/guess-url-type": { + "version": "1.2.1", + "resolved": "https://registry.nlark.com/@remusao/guess-url-type/download/@remusao/guess-url-type-1.2.1.tgz", + "integrity": "sha1-s+fDKr35jQ+0+TzGfK1YC1/kulc=" + }, + "@remusao/small": { + "version": "1.2.1", + "resolved": "https://registry.nlark.com/@remusao/small/download/@remusao/small-1.2.1.tgz", + "integrity": "sha1-Y7/kVIgyKJ+UrIaKDDBZcMmg5fk=" + }, + "@remusao/smaz": { + "version": "1.9.1", + "resolved": "https://registry.nlark.com/@remusao/smaz/download/@remusao/smaz-1.9.1.tgz", + "integrity": "sha1-ormwRThfgeFhWmjZMrfMiwTJ240=", + "requires": { + "@remusao/smaz-compress": "^1.9.1", + "@remusao/smaz-decompress": "^1.9.1" + } + }, + "@remusao/smaz-compress": { + "version": "1.9.1", + "resolved": "https://registry.nlark.com/@remusao/smaz-compress/download/@remusao/smaz-compress-1.9.1.tgz", + "integrity": "sha1-/HXq+bysLVi8TD1RgYOny5YS0nU=", + "requires": { + "@remusao/trie": "^1.4.1" + } + }, + "@remusao/smaz-decompress": { + "version": "1.9.1", + "resolved": "https://registry.nlark.com/@remusao/smaz-decompress/download/@remusao/smaz-decompress-1.9.1.tgz", + "integrity": "sha1-gJT5l+j7WRpnjNqc8IwgnIJeuls=" + }, + "@remusao/trie": { + "version": "1.4.1", + "resolved": "https://registry.nlark.com/@remusao/trie/download/@remusao/trie-1.4.1.tgz", + "integrity": "sha1-dV0J+KAHR2M05hH0Jxmy1YHwByA=" + }, + "@types/chrome": { + "version": "0.0.91", + "resolved": "https://registry.nlark.com/@types/chrome/download/@types/chrome-0.0.91.tgz", + "integrity": "sha1-SzmW9V80QFfmpnfINmqpgIDG44A=", + "requires": { + "@types/filesystem": "*" + } + }, "@types/debug": { "version": "4.1.5", "resolved": "https://registry.nlark.com/@types/debug/download/@types/debug-4.1.5.tgz?cache=0&sync_timestamp=1621240863945&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fdebug%2Fdownload%2F%40types%2Fdebug-4.1.5.tgz", "integrity": "sha1-sU76iFK3do2JiQZhPCP2iHE+As0=" }, + "@types/filesystem": { + "version": "0.0.32", + "resolved": "https://registry.nlark.com/@types/filesystem/download/@types/filesystem-0.0.32.tgz", + "integrity": "sha1-MH33zAhKIpPDwaMRUbF4Bj4Kjt8=", + "requires": { + "@types/filewriter": "*" + } + }, + "@types/filewriter": { + "version": "0.0.29", + "resolved": "https://registry.nlark.com/@types/filewriter/download/@types/filewriter-0.0.29.tgz", + "integrity": "sha1-pIeV7K35V/bA0Q4MNK+GwJj6W+4=" + }, + "@types/firefox-webext-browser": { + "version": "82.0.1", + "resolved": "https://registry.nlark.com/@types/firefox-webext-browser/download/@types/firefox-webext-browser-82.0.1.tgz", + "integrity": "sha1-GX3sHRdbCZ642skunJyaVIKl3Yo=" + }, + "@types/har-format": { + "version": "1.2.7", + "resolved": "https://registry.nlark.com/@types/har-format/download/@types/har-format-1.2.7.tgz", + "integrity": "sha1-3r/jY3jybE/Cq8od+Z8AqP+U/Sk=" + }, "@types/node": { "version": "15.6.1", "resolved": "https://registry.nlark.com/@types/node/download/@types/node-15.6.1.tgz?cache=0&sync_timestamp=1621901524629&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-15.6.1.tgz", @@ -1290,6 +1599,72 @@ "merge-deep": "^3.0.1" } }, + "puppeteer-extra-plugin-adblocker": { + "version": "2.11.11", + "resolved": "https://registry.nlark.com/puppeteer-extra-plugin-adblocker/download/puppeteer-extra-plugin-adblocker-2.11.11.tgz", + "integrity": "sha1-oBtbrE+noc5rlJIwahvJZJ4iZVw=", + "requires": { + "@cliqz/adblocker-puppeteer": "1.18.7", + "@types/chrome": "0.0.91", + "debug": "^4.1.1", + "node-fetch": "^2.6.0", + "puppeteer-extra-plugin": "^3.1.9" + }, + "dependencies": { + "@cliqz/adblocker-puppeteer": { + "version": "1.18.7", + "resolved": "https://registry.nlark.com/@cliqz/adblocker-puppeteer/download/@cliqz/adblocker-puppeteer-1.18.7.tgz", + "integrity": "sha1-8ZZFpsepi5Q0gNscmpaAyX8dGf4=", + "requires": { + "@cliqz/adblocker": "^1.18.7", + "@cliqz/adblocker-content": "^1.18.7", + "tldts-experimental": "^5.6.21" + } + }, + "agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npm.taobao.org/agent-base/download/agent-base-5.1.1.tgz?cache=0&sync_timestamp=1603480041218&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fagent-base%2Fdownload%2Fagent-base-5.1.1.tgz", + "integrity": "sha1-6Ps/JClZ20TWO+Zl23qOc5U3oyw=", + "peer": true + }, + "devtools-protocol": { + "version": "0.0.818844", + "resolved": "https://registry.nlark.com/devtools-protocol/download/devtools-protocol-0.0.818844.tgz?cache=0&sync_timestamp=1628842777079&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdevtools-protocol%2Fdownload%2Fdevtools-protocol-0.0.818844.tgz", + "integrity": "sha1-0ZRyeOyFtT5MjKWY9geij6eFup4=", + "peer": true + }, + "https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/https-proxy-agent/download/https-proxy-agent-4.0.0.tgz", + "integrity": "sha1-cCtx+1UgoTKmbeH2dUHZ5iFU2Cs=", + "peer": true, + "requires": { + "agent-base": "5", + "debug": "4" + } + }, + "puppeteer": { + "version": "5.5.0", + "resolved": "https://registry.nlark.com/puppeteer/download/puppeteer-5.5.0.tgz?cache=0&sync_timestamp=1628081917525&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpuppeteer%2Fdownload%2Fpuppeteer-5.5.0.tgz", + "integrity": "sha1-Mxp+3SEsoGtKVWFWQ19Yy64IrwA=", + "peer": true, + "requires": { + "debug": "^4.1.0", + "devtools-protocol": "0.0.818844", + "extract-zip": "^2.0.0", + "https-proxy-agent": "^4.0.0", + "node-fetch": "^2.6.1", + "pkg-dir": "^4.2.0", + "progress": "^2.0.1", + "proxy-from-env": "^1.0.0", + "rimraf": "^3.0.2", + "tar-fs": "^2.0.0", + "unbzip2-stream": "^1.3.3", + "ws": "^7.2.3" + } + } + } + }, "puppeteer-extra-plugin-recaptcha": { "version": "3.4.0", "resolved": "https://registry.nlark.com/puppeteer-extra-plugin-recaptcha/download/puppeteer-extra-plugin-recaptcha-3.4.0.tgz", @@ -1416,6 +1791,19 @@ "resolved": "https://registry.npm.taobao.org/through/download/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, + "tldts-core": { + "version": "5.7.40", + "resolved": "https://registry.nlark.com/tldts-core/download/tldts-core-5.7.40.tgz", + "integrity": "sha1-bghPv/J67XttCQulYzoE2canwEs=" + }, + "tldts-experimental": { + "version": "5.7.40", + "resolved": "https://registry.nlark.com/tldts-experimental/download/tldts-experimental-5.7.40.tgz", + "integrity": "sha1-TN5pKX7E2Fr1RTIoOqkpXvB7Ilg=", + "requires": { + "tldts-core": "^5.7.40" + } + }, "unbzip2-stream": { "version": "1.3.3", "resolved": "https://registry.npm.taobao.org/unbzip2-stream/download/unbzip2-stream-1.3.3.tgz", diff --git a/package.json b/package.json index 05698fc..965e77f 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "dependencies": { "puppeteer": "^10.2.0", "puppeteer-extra": "^3.1.18", + "puppeteer-extra-plugin-adblocker": "^2.11.11", "puppeteer-extra-plugin-recaptcha": "^3.4.0", "puppeteer-extra-plugin-stealth": "^2.7.8" } From cab96b3cb5d8ee076740db53768c5be495b4541e Mon Sep 17 00:00:00 2001 From: ye4241 Date: Sat, 14 Aug 2021 03:33:03 +0800 Subject: [PATCH 03/13] fix login bug when cookies invalid; --- utils/helper.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/utils/helper.js b/utils/helper.js index d0527c5..5a68bc4 100644 --- a/utils/helper.js +++ b/utils/helper.js @@ -1,3 +1,6 @@ +const loginUrl = 'https://www.textnow.com/login'; +const messagingUrl = 'https://www.textnow.com/messaging'; + /** * Log into TextNow and get cookies * @param {object} page Puppeteer browser page @@ -9,9 +12,9 @@ module.exports.logIn = async ( page, client, username = undefined, password = undefined) => { await Promise.all([ - page.goto('https://www.textnow.com/login'), + page.goto(loginUrl), page.setDefaultNavigationTimeout(0), - page.waitForNavigation({waitUtil: 'networkidle2'}), + page.waitForNavigation({waitUtil: 'domcontentloaded'}), ]); // Resolve captcha if found. @@ -26,7 +29,7 @@ module.exports.logIn = async ( ]); } - if (username && password) { + if (page.url() === loginUrl && username && password) { await page.type('#txt-username', username); await page.type('#txt-password', password); @@ -36,7 +39,7 @@ module.exports.logIn = async ( return (await client.send('Network.getAllCookies')).cookies; } - const isLoggedIn = page.url().includes('/messaging'); + const isLoggedIn = page.url() === messagingUrl; if (!isLoggedIn) { throw new Error('Detected invalid or expires cookies'); } @@ -51,8 +54,8 @@ module.exports.logIn = async ( */ module.exports.selectConversation = async (page, recipient) => { await Promise.all([ - page.goto('https://www.textnow.com/messaging'), - page.waitForNavigation({waitUtil: 'networkidle2'}), + page.goto(messagingUrl), + page.waitForNavigation({waitUtil: 'domcontentloaded'}), ]); await page.waitForTimeout(5000); From 65fffad32d31ba9ec7f24aef159aa50f122650e3 Mon Sep 17 00:00:00 2001 From: ye4241 Date: Sat, 14 Aug 2021 03:34:52 +0800 Subject: [PATCH 04/13] reverse page navigation wait logic; --- utils/helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/helper.js b/utils/helper.js index 5a68bc4..09827de 100644 --- a/utils/helper.js +++ b/utils/helper.js @@ -14,7 +14,7 @@ module.exports.logIn = async ( await Promise.all([ page.goto(loginUrl), page.setDefaultNavigationTimeout(0), - page.waitForNavigation({waitUtil: 'domcontentloaded'}), + page.waitForNavigation({waitUtil: 'networkidle2'}), ]); // Resolve captcha if found. @@ -55,7 +55,7 @@ module.exports.logIn = async ( module.exports.selectConversation = async (page, recipient) => { await Promise.all([ page.goto(messagingUrl), - page.waitForNavigation({waitUtil: 'domcontentloaded'}), + page.waitForNavigation({waitUtil: 'networkidle2'}), ]); await page.waitForTimeout(5000); From 245d7b9f5ab25a2ab341ff302e1b7cb093b3e5d0 Mon Sep 17 00:00:00 2001 From: ye4241 Date: Sat, 14 Aug 2021 03:42:02 +0800 Subject: [PATCH 05/13] move navigation timeout out; --- index.js | 2 ++ utils/helper.js | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index ea42805..a36ea3d 100644 --- a/index.js +++ b/index.js @@ -47,6 +47,8 @@ const actionFunc = async ( ], }); page = await browser.newPage(); + page.setDefaultNavigationTimeout(0); + page.setDefaultTimeout(0); const client = await page.target().createCDPSession(); try { diff --git a/utils/helper.js b/utils/helper.js index 09827de..8954806 100644 --- a/utils/helper.js +++ b/utils/helper.js @@ -13,8 +13,7 @@ module.exports.logIn = async ( page, client, username = undefined, password = undefined) => { await Promise.all([ page.goto(loginUrl), - page.setDefaultNavigationTimeout(0), - page.waitForNavigation({waitUtil: 'networkidle2'}), + page.waitForNavigation(), ]); // Resolve captcha if found. @@ -55,7 +54,7 @@ module.exports.logIn = async ( module.exports.selectConversation = async (page, recipient) => { await Promise.all([ page.goto(messagingUrl), - page.waitForNavigation({waitUtil: 'networkidle2'}), + page.waitForNavigation(), ]); await page.waitForTimeout(5000); From 24087770923aedb159b735a50a728ee7383eef7a Mon Sep 17 00:00:00 2001 From: ye4241 Date: Sat, 14 Aug 2021 03:45:12 +0800 Subject: [PATCH 06/13] reverse some codes; --- utils/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/helper.js b/utils/helper.js index 8954806..82e433a 100644 --- a/utils/helper.js +++ b/utils/helper.js @@ -28,7 +28,7 @@ module.exports.logIn = async ( ]); } - if (page.url() === loginUrl && username && password) { + if (username && password) { await page.type('#txt-username', username); await page.type('#txt-password', password); From f082b05f9f187313b875f8f84ca7f1eaa2676a04 Mon Sep 17 00:00:00 2001 From: ye4241 Date: Sat, 14 Aug 2021 03:49:57 +0800 Subject: [PATCH 07/13] remove cookie if invalid; --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index a36ea3d..f5cfc61 100644 --- a/index.js +++ b/index.js @@ -73,6 +73,7 @@ const actionFunc = async ( await page.setCookie(...cookies); cookies = await textNowHelper.logIn(page, client); } catch (error) { + await client.send('Network.clearBrowserCookies'); console.log(`Failed to log in with existing cookies: ${error}`); console.log('Logging in with account credentials...'); cookies = await textNowHelper.logIn(page, client, username, password); From 66513b60dc482fd7269b47fe46c45d04639b06a9 Mon Sep 17 00:00:00 2001 From: ye4241 Date: Sat, 14 Aug 2021 03:53:22 +0800 Subject: [PATCH 08/13] reverse navigation timeout again; --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index f5cfc61..f1fa1e4 100644 --- a/index.js +++ b/index.js @@ -48,7 +48,6 @@ const actionFunc = async ( }); page = await browser.newPage(); page.setDefaultNavigationTimeout(0); - page.setDefaultTimeout(0); const client = await page.target().createCDPSession(); try { From 68331ee21e361f79a0445ca88fc4d7c2fde0a1b7 Mon Sep 17 00:00:00 2001 From: ye4241 Date: Sat, 14 Aug 2021 03:58:16 +0800 Subject: [PATCH 09/13] reverse navigation wait again; --- utils/helper.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utils/helper.js b/utils/helper.js index 82e433a..3cab989 100644 --- a/utils/helper.js +++ b/utils/helper.js @@ -13,7 +13,7 @@ module.exports.logIn = async ( page, client, username = undefined, password = undefined) => { await Promise.all([ page.goto(loginUrl), - page.waitForNavigation(), + page.waitForNavigation({waitUtil: 'networkidle2'}), ]); // Resolve captcha if found. @@ -33,7 +33,10 @@ module.exports.logIn = async ( await page.type('#txt-password', password); const logInButton = await page.waitForSelector('#btn-login'); - await Promise.all([logInButton.click(), page.waitForNavigation()]); + await Promise.all([ + logInButton.click(), + page.waitForNavigation({waitUtil: 'networkidle2'}), + ]); return (await client.send('Network.getAllCookies')).cookies; } @@ -54,7 +57,7 @@ module.exports.logIn = async ( module.exports.selectConversation = async (page, recipient) => { await Promise.all([ page.goto(messagingUrl), - page.waitForNavigation(), + page.waitForNavigation({waitUtil: 'networkidle2'}), ]); await page.waitForTimeout(5000); From 8691bffc6b1f8ced22f9b9c95a8d6c7000778a08 Mon Sep 17 00:00:00 2001 From: ye4241 Date: Sat, 14 Aug 2021 14:07:59 +0800 Subject: [PATCH 10/13] change puppeteer headless into false to avoid login issues; --- .github/workflows/action.yml | 11 +++++++---- .gitignore | 1 + index.js | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index d4a8740..bfc93f3 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -13,10 +13,12 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: - node-version: "12.x" + node-version: '14' - name: Install dependencies + env: + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true' run: npm install - name: Cache multi paths uses: actions/cache@v2 @@ -27,6 +29,7 @@ jobs: key: ${{ secrets.CACHE_NAME }}-${{ github.run_id }} restore-keys: ${{ secrets.CACHE_NAME }}- - name: Run autosend + uses: mujo-code/puppeteer-headful@master env: TEXTNOW_USERNAME: ${{secrets.TEXTNOW_USERNAME}} TEXTNOW_PASSWORD: ${{secrets.TEXTNOW_PASSWORD}} @@ -34,5 +37,5 @@ jobs: TEXTNOW_RECIPIENT: ${{secrets.TEXTNOW_RECIPIENT}} TEXTNOW_MESSAGE: ${{secrets.TEXTNOW_MESSAGE}} CAPTCHA_TOKEN: ${{secrets.CAPTCHA_TOKEN}} - run: | - node index.js + with: + args: npm start diff --git a/.gitignore b/.gitignore index f875854..5e6ea0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules .cache .idea +.env diff --git a/index.js b/index.js index f1fa1e4..f8ef9b6 100644 --- a/index.js +++ b/index.js @@ -37,13 +37,13 @@ const actionFunc = async ( puppeteer.use(adblockerPlugin()); browser = await puppeteer.launch({ - headless: true, + headless: false, + executablePath: process.env.PUPPETEER_EXEC_PATH, args: [ process.env.HTTP_PROXY ? `--proxy-server=${process.env.HTTP_PROXY}` : '', - '--disable-features=IsolateOrigins,site-per-process', - '--flag-switches-begin --disable-site-isolation-trials --flag-switches-end', + '--no-sandbox', ], }); page = await browser.newPage(); From c660858d37482798ea85b3d7e0628993c89f7568 Mon Sep 17 00:00:00 2001 From: ye4241 Date: Sat, 14 Aug 2021 14:12:06 +0800 Subject: [PATCH 11/13] change node version to 12; --- .github/workflows/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index bfc93f3..b9d36bf 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -15,7 +15,7 @@ jobs: - name: Setup node.js uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '12' - name: Install dependencies env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true' From 3cb3235a003047cf859fd3d14d476e37c4b4db6f Mon Sep 17 00:00:00 2001 From: ye4241 Date: Sat, 14 Aug 2021 14:25:43 +0800 Subject: [PATCH 12/13] fix page loaded twice if cookie is null; --- index.js | 6 +++++- utils/helper.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f8ef9b6..73f982b 100644 --- a/index.js +++ b/index.js @@ -55,6 +55,7 @@ const actionFunc = async ( cookies = JSON.parse(Buffer.from(cookies, 'base64').toString()); } catch (error) { console.log(`Environment cookies is invalid format: ${error}`); + cookies = null; try { console.log('Importing existing cookies from file...'); const cookiesString = await fs.readFile( @@ -63,16 +64,19 @@ const actionFunc = async ( cookies = JSON.parse(cookiesString.toString()); } catch (error) { console.log(`Failed to import existing cookies: ${error}`); + cookies = null; } } // Log into TextNow and get cookies try { + if (cookies === null) { + throw new Error("Cookies is null"); + } console.log('Logging in with existing cookies'); await page.setCookie(...cookies); cookies = await textNowHelper.logIn(page, client); } catch (error) { - await client.send('Network.clearBrowserCookies'); console.log(`Failed to log in with existing cookies: ${error}`); console.log('Logging in with account credentials...'); cookies = await textNowHelper.logIn(page, client, username, password); diff --git a/utils/helper.js b/utils/helper.js index 3cab989..e7bbef1 100644 --- a/utils/helper.js +++ b/utils/helper.js @@ -43,6 +43,7 @@ module.exports.logIn = async ( const isLoggedIn = page.url() === messagingUrl; if (!isLoggedIn) { + await client.send('Network.clearBrowserCookies'); throw new Error('Detected invalid or expires cookies'); } From bd783d7b30761331e1e2566da36ce62efe309a71 Mon Sep 17 00:00:00 2001 From: ye4241 <6803102+ye4241@users.noreply.github.com> Date: Thu, 14 Oct 2021 11:38:19 +0800 Subject: [PATCH 13/13] Update action.yml --- .github/workflows/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index b9d36bf..07c31c7 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: schedule: - - cron: "44 16 * * *" + - cron: "45 16 * * *" jobs: autosend: runs-on: ubuntu-latest