TikTokOpen / TikTok /TikTokApi /stealth /js /chrome_hairline.py
pane2k's picture
Upload folder using huggingface_hub
7e4b742 verified
raw
history blame contribute delete
497 Bytes
chrome_hairline = """
// https://intoli.com/blog/making-chrome-headless-undetectable/
// store the existing descriptor
const elementDescriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'offsetHeight');
// redefine the property with a patched descriptor
Object.defineProperty(HTMLDivElement.prototype, 'offsetHeight', {
...elementDescriptor,
get: function() {
if (this.id === 'modernizr') {
return 1;
}
return elementDescriptor.get.apply(this);
},
});
"""