github-actions[bot] commited on
Commit
84ab4d3
·
1 Parent(s): 0f18588

Update from GitHub Actions

Browse files
Files changed (1) hide show
  1. src/index.ts +0 -31
src/index.ts CHANGED
@@ -211,44 +211,13 @@ app.get('/genspark', async (c) => {
211
  await gensparkContext.clearCookies()
212
  await gensparkContext.addCookies(cookies);
213
  }
214
- await new Promise(resolve => setTimeout(resolve, 1000));
215
  const gensparkPage = await gensparkContext.newPage()
216
  try {
217
- // 模拟真实用户行为
218
- await gensparkPage.route('**/*', (route) => {
219
- return route.request().resourceType() === 'image'
220
- ? route.abort()
221
- : route.continue()
222
- })
223
-
224
  //刷新页面以确保获取新令牌
225
  await gensparkPage.goto('https://www.genspark.ai/agents?type=moa_chat', {
226
  waitUntil: 'networkidle',
227
  timeout: 3600000
228
  })
229
-
230
- // 等待并模拟人类交互
231
- await gensparkPage.waitForTimeout(Math.random() * 1500 + 1000)
232
-
233
- // 随机鼠标移动
234
- await gensparkPage.mouse.move(
235
- Math.random() * gensparkPage.viewportSize()!.width,
236
- Math.random() * gensparkPage.viewportSize()!.height
237
- )
238
-
239
- // 随机延迟点击
240
- await gensparkPage.waitForTimeout(Math.random() * 1500 + 500)
241
-
242
- // 使用精确的选择器定位输入框
243
- // 多种定位方式供选择
244
- const inputSelector = 'textarea[name="query"].search-input';
245
-
246
- // 等待输入框出现
247
- await gensparkPage.waitForSelector(inputSelector, { state: 'visible', timeout: 5000 });
248
- gensparkPage.focus(inputSelector);
249
- // 可选:触发搜索/提交
250
- await gensparkPage.keyboard.press('Enter');
251
-
252
  // 执行脚本获取令牌
253
  const token = await gensparkPage.evaluate(() => {
254
  return new Promise((resolve, reject) => {
 
211
  await gensparkContext.clearCookies()
212
  await gensparkContext.addCookies(cookies);
213
  }
 
214
  const gensparkPage = await gensparkContext.newPage()
215
  try {
 
 
 
 
 
 
 
216
  //刷新页面以确保获取新令牌
217
  await gensparkPage.goto('https://www.genspark.ai/agents?type=moa_chat', {
218
  waitUntil: 'networkidle',
219
  timeout: 3600000
220
  })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  // 执行脚本获取令牌
222
  const token = await gensparkPage.evaluate(() => {
223
  return new Promise((resolve, reject) => {