Spaces:
Running
Running
Update src/index.ts
Browse files- src/index.ts +2 -59
src/index.ts
CHANGED
@@ -35,25 +35,8 @@ async function initGensparkPage(cookies?: any[]) {
|
|
35 |
|
36 |
if (!gensparkContext) {
|
37 |
gensparkContext = await browser.newContext({
|
38 |
-
|
39 |
-
|
40 |
-
hasTouch: false,
|
41 |
-
javaScriptEnabled: true,
|
42 |
-
locale: 'en-US',
|
43 |
-
timezoneId: 'America/New_York',
|
44 |
-
geolocation: { longitude: -74.006, latitude: 40.7128 }, // New York coordinates
|
45 |
-
permissions: ['geolocation'],
|
46 |
-
colorScheme: 'light',
|
47 |
-
reducedMotion: 'no-preference',
|
48 |
-
forcedColors: 'none',
|
49 |
-
acceptDownloads: true,
|
50 |
-
ignoreHTTPSErrors: true,
|
51 |
-
bypassCSP: true,
|
52 |
-
extraHTTPHeaders: {
|
53 |
-
'Accept-Language': 'en-US,en;q=0.9',
|
54 |
-
'DNT': '1',
|
55 |
-
'Upgrade-Insecure-Requests': '1',
|
56 |
-
}
|
57 |
})
|
58 |
}
|
59 |
if (cookies && cookies.length > 0) {
|
@@ -66,46 +49,6 @@ async function initGensparkPage(cookies?: any[]) {
|
|
66 |
waitUntil: 'networkidle',
|
67 |
timeout: 60000
|
68 |
})
|
69 |
-
|
70 |
-
// Override specific browser properties to avoid detection
|
71 |
-
// await gensparkPage.addInitScript(() => {
|
72 |
-
// // Override the navigator properties
|
73 |
-
// Object.defineProperty(navigator, 'webdriver', { get: () => false });
|
74 |
-
// Object.defineProperty(navigator, 'plugins', { get: () => [1, 2, 3, 4, 5] });
|
75 |
-
// Object.defineProperty(navigator, 'languages', { get: () => ['en-US', 'en'] });
|
76 |
-
|
77 |
-
// // Add fake web audio and canvas fingerprints
|
78 |
-
// const originalGetImageData = CanvasRenderingContext2D.prototype.getImageData;
|
79 |
-
// CanvasRenderingContext2D.prototype.getImageData = function(x, y, w, h) {
|
80 |
-
// const imageData = originalGetImageData.call(this, x, y, w, h);
|
81 |
-
// // Add some noise to the canvas data
|
82 |
-
// for (let i = 0; i < imageData.data.length; i += 4) {
|
83 |
-
// imageData.data[i] = imageData.data[i] + Math.floor(Math.random() * 5);
|
84 |
-
// imageData.data[i+1] = imageData.data[i+1] + Math.floor(Math.random() * 5);
|
85 |
-
// imageData.data[i+2] = imageData.data[i+2] + Math.floor(Math.random() * 5);
|
86 |
-
// }
|
87 |
-
// return imageData;
|
88 |
-
// };
|
89 |
-
|
90 |
-
// });
|
91 |
-
// Simulate human-like behavior
|
92 |
-
// await gensparkPage.addInitScript(() => {
|
93 |
-
// // Add random mouse movements
|
94 |
-
// let lastMove = Date.now();
|
95 |
-
// document.addEventListener('mousemove', function() {
|
96 |
-
// lastMove = Date.now();
|
97 |
-
// }, true);
|
98 |
-
|
99 |
-
// // Simulate scroll behavior
|
100 |
-
// window.addEventListener('scroll', function() {
|
101 |
-
// // Random scroll speed
|
102 |
-
// const scrollSpeed = Math.floor(Math.random() * 10) + 5;
|
103 |
-
// const scrollAmount = Math.floor(Math.random() * 100);
|
104 |
-
// setTimeout(() => {
|
105 |
-
// window.scrollBy(0, scrollAmount);
|
106 |
-
// }, scrollSpeed);
|
107 |
-
// }, true);
|
108 |
-
// });
|
109 |
console.log('GenSpark页面已初始化')
|
110 |
}
|
111 |
return gensparkPage
|
|
|
35 |
|
36 |
if (!gensparkContext) {
|
37 |
gensparkContext = await browser.newContext({
|
38 |
+
locale: 'zh-CN',
|
39 |
+
userAgent: userAgent,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
})
|
41 |
}
|
42 |
if (cookies && cookies.length > 0) {
|
|
|
49 |
waitUntil: 'networkidle',
|
50 |
timeout: 60000
|
51 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
console.log('GenSpark页面已初始化')
|
53 |
}
|
54 |
return gensparkPage
|