Rename to hkt.sh
This commit is contained in:
47
node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.js
generated
vendored
Normal file
47
node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict'
|
||||
|
||||
const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin')
|
||||
|
||||
const argsToIgnore = [
|
||||
'--disable-extensions',
|
||||
'--disable-default-apps',
|
||||
'--disable-component-extensions-with-background-pages'
|
||||
]
|
||||
|
||||
/**
|
||||
* A CDP driver like puppeteer can make use of various browser launch arguments that are
|
||||
* adversarial to mimicking a regular browser and need to be stripped when launching the browser.
|
||||
*/
|
||||
class Plugin extends PuppeteerExtraPlugin {
|
||||
constructor(opts = {}) {
|
||||
super(opts)
|
||||
}
|
||||
|
||||
get name() {
|
||||
return 'stealth/evasions/defaultArgs'
|
||||
}
|
||||
|
||||
get requirements() {
|
||||
return new Set(['runLast']) // So other plugins can modify launch options before
|
||||
}
|
||||
|
||||
async beforeLaunch(options = {}) {
|
||||
options.ignoreDefaultArgs = options.ignoreDefaultArgs || []
|
||||
if (options.ignoreDefaultArgs === true) {
|
||||
// that means the user explicitly wants to disable all default arguments
|
||||
return
|
||||
}
|
||||
argsToIgnore.forEach(arg => {
|
||||
if (options.ignoreDefaultArgs.includes(arg)) {
|
||||
return
|
||||
}
|
||||
options.ignoreDefaultArgs.push(arg)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function (pluginConfig) {
|
||||
return new Plugin(pluginConfig)
|
||||
}
|
||||
|
||||
module.exports.argsToIgnore = argsToIgnore
|
||||
36
node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.test.js
generated
vendored
Normal file
36
node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.test.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
const test = require('ava')
|
||||
|
||||
const { vanillaPuppeteer, addExtra } = require('../../test/util')
|
||||
const Plugin = require('.')
|
||||
const { argsToIgnore } = require('.')
|
||||
|
||||
test('vanilla: uses args to ignore', async t => {
|
||||
const browser = await vanillaPuppeteer.launch({ headless: true })
|
||||
const page = await browser.newPage()
|
||||
const client =
|
||||
typeof page._client === 'function' ? page._client() : page._client
|
||||
const { arguments: launchArgs } = await client.send(
|
||||
'Browser.getBrowserCommandLine'
|
||||
)
|
||||
const ok = argsToIgnore.every(arg => launchArgs.includes(arg))
|
||||
if (!ok) {
|
||||
console.log({ argsToIgnore, launchArgs })
|
||||
}
|
||||
t.is(ok, true)
|
||||
})
|
||||
|
||||
test('stealth: does not use args to ignore', async t => {
|
||||
const puppeteer = addExtra(vanillaPuppeteer).use(Plugin())
|
||||
const browser = await puppeteer.launch({ headless: true })
|
||||
const page = await browser.newPage()
|
||||
const client =
|
||||
typeof page._client === 'function' ? page._client() : page._client
|
||||
const { arguments: launchArgs } = await client.send(
|
||||
'Browser.getBrowserCommandLine'
|
||||
)
|
||||
const ok = argsToIgnore.every(arg => !launchArgs.includes(arg))
|
||||
if (!ok) {
|
||||
console.log({ argsToIgnore, launchArgs })
|
||||
}
|
||||
t.is(ok, true)
|
||||
})
|
||||
4
node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/package.json
generated
vendored
Normal file
4
node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/package.json
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"private": true,
|
||||
"main": "index.js"
|
||||
}
|
||||
18
node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/readme.md
generated
vendored
Normal file
18
node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/readme.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
## API
|
||||
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
#### Table of Contents
|
||||
|
||||
- [class: Plugin](#class-plugin)
|
||||
|
||||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/358246d5cc56bbb8800624128503482b8d7b426a/packages/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.js#L15-L41)
|
||||
|
||||
- `opts` (optional, default `{}`)
|
||||
|
||||
**Extends: PuppeteerExtraPlugin**
|
||||
|
||||
A CDP driver like puppeteer can make use of various browser launch arguments that are
|
||||
adversarial to mimicking a regular browser and need to be stripped when launching the browser.
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user