fix: anti-detection
This commit is contained in:
parent
33d53b73eb
commit
a583f52a5e
1 changed files with 10 additions and 2 deletions
|
@ -53,14 +53,22 @@ export const hideFromArrFilter = (() => {
|
|||
|
||||
const qsaHook = (_fn) => {
|
||||
return function (...args) {
|
||||
const arr = _fn.apply(this, args)
|
||||
const nodes = _fn.apply(this, args)
|
||||
const results = Array.prototype.filter.call(nodes, (e) => !l.has(e))
|
||||
|
||||
// convert back to a NodeList/HTMLCollection instead of an Array
|
||||
Object.setPrototypeOf(results, Object.getPrototypeOf(nodes))
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return Array.prototype.filter.call(arr, (e) => !l.has(e))
|
||||
return results
|
||||
}
|
||||
}
|
||||
hookNative(Element.prototype, 'querySelectorAll', qsaHook)
|
||||
hookNative(document, 'querySelectorAll', qsaHook)
|
||||
|
||||
hookNative(Element.prototype, 'getElementsByClassName', qsaHook)
|
||||
hookNative(document, 'getElementsByClassName', qsaHook)
|
||||
|
||||
return (item: any) => {
|
||||
l.add(item)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue