PUGE 5 月之前
父節點
當前提交
27dc1bd786

+ 8 - 5
config.json

@@ -1,7 +1,7 @@
 {
-    "enterURL": "https://douhot.douyin.com/m/#/pages/square/index",
-    "width": 375,
-    "height": 667,
+    "enterURL": "https://www.ea.com/ea-sports-fc/ultimate-team/web-app/",
+    "width": 1920,
+    "height": 1080,
     "webPreferences": {
         "webSecurity": false,
         "nodeIntegration": false,
@@ -11,14 +11,17 @@
         "enableRemoteModule": false,
         "safeDialogs": false
     },
-    "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1",
+    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
     "autoHideMenuBar": true,
     "redirect":[],
     "redirectURL":"",
     "proxy":"",
     "noCache": false,
     "interceptor":[
-        "*://douhot.douyin.com/douhot/v1/material/video_billboard*"
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/auth",
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/tradepile",
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/trade/",
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/auctionhouse"
     ],
     "preLoadFile": "<dir>/preLoadFile.js"
 }

+ 4 - 2
dist/ea-sports-fc/config.json

@@ -18,8 +18,10 @@
     "proxy":"",
     "noCache": false,
     "interceptor":[
-        "https://utas.mob.v4.prd.futc-ext.gcp.ea.com/ut/game/fc25/usermassinfo",
-        "https://utas.mob.v4.prd.futc-ext.gcp.ea.com/ut/game/fc25/auctionhouse"
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/auth",
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/tradepile",
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/trade/",
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/auctionhouse"
     ],
     "preLoadFile": "<dir>/preLoadFile.js"
 }

File diff suppressed because it is too large
+ 33 - 8
dist/ea-sports-fc/preLoadFile.js


+ 2 - 3
dist/ea-sports-fc/preload.js

@@ -25,9 +25,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
   readdir: (msg) => ipcRenderer.send('readdir', msg),
   download: (msg) => ipcRenderer.send('download', msg),
   broadcast: (msg) => ipcRenderer.send('broadcast-message', msg),
+  saveFile: (msg) => ipcRenderer.invoke('saveFile', msg),
   onBroadcast: (callback) => ipcRenderer.on('message-broadcast', (event, data) => callback(data))
 });
 
-window.onInterceptedData = (data)=> {
-  alert(JSON.stringify(data))
-}
+

+ 0 - 17
dist/goopi抢购/config.json

@@ -1,17 +0,0 @@
-{
-    "enterURL": "https://www.goopi.co/categories/goopimade-1?sort_by=created_at&order_by=desc",
-    "width": 1920,
-    "height": 1080,
-    "webPreferences": {
-        "webSecurity": false,
-        "nodeIntegration": false,
-        "nativeWindowOpen": false,
-        "preload": "<dir>/preload.js"
-    },
-    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
-    "autoHideMenuBar": true,
-    "redirect":[],
-    "redirectURL":"",
-    "proxy":"",
-    "noCache": false
-}

+ 0 - 79
dist/goopi抢购/preload.js

@@ -1,79 +0,0 @@
-window.busying = false
-
-// 处理 AngularJS 集成
-function handleAngularJS(select) {
-    try {
-        const scope = angular.element(select).scope();
-        if (scope && scope.$apply) {
-            scope.$apply(function() {
-                // 确保 AngularJS 知道变化
-                const modelName = select.getAttribute('ng-model');
-                if (modelName) {
-                    scope[modelName] = select.value;
-                }
-            });
-        }
-    } catch (error) {
-        console.log('AngularJS 处理失败(可忽略):', error);
-    }
-}
-
-function triggerChangeEvents(select) {
-    const events = ['input', 'change', 'blur'];
-    events.forEach(eventType => {
-        const event = new Event(eventType, { bubbles: true });
-        select.dispatchEvent(event);
-    });
-}
-
-function selectThirdOrString3(selectorStr) {
-    const select = document.querySelector('.selectpicker');
-    if (!select) return false;
-    
-    // 首先尝试选择值为 "string:3號" 的选项
-    for (let i = 0; i < select.options.length; i++) {
-        if (select.options[i].value.includes(selectorStr)) {
-            select.selectedIndex = i;
-            triggerChangeEvents(select);
-            handleAngularJS(select);
-            console.log('已选择: ' + selectorStr);
-            return true;
-        }
-    }
-    
-    console.log('未找到匹配的选项');
-    return false;
-}
-
-
-
-setInterval(() => {
-    if (!window.busying) {
-        if (location.href.includes('https://www.goopi.co/products/')) {
-            document.title = '运行中!'
-            // 先判断 货号
-            selectThirdOrString3('string:3號');
-            if (document.querySelector('#btn-main-checkout')) {
-                window.busying = true
-                document.title = '跳转中!'
-                setTimeout(() => {
-                    location.href="https://www.goopi.co/checkout"
-                }, 1000);
-            }
-            if (document.querySelector('[ng-if="!isItemInBackInStock"]')) {
-                window.busying = true
-                setTimeout(() => {
-                    window.busying = false
-                    location.reload()
-                }, 3000);
-            }
-        }
-        if (location.href.includes('https://www.goopi.co/cart')) {
-            document.title = '结账中!'
-            window.busying = true
-            if (document.querySelector('.btn-checkout')) {
-                document.querySelector('.btn-checkout').click()
-            }
-        }
-    }
-}, 1000);

+ 27 - 0
dist/win-ia32-unpacked/config.json

@@ -0,0 +1,27 @@
+{
+    "enterURL": "https://www.ea.com/ea-sports-fc/ultimate-team/web-app/",
+    "width": 1920,
+    "height": 1080,
+    "webPreferences": {
+        "webSecurity": false,
+        "nodeIntegration": false,
+        "nativeWindowOpen": false,
+        "preload": "<dir>/preload.js",
+        "worldSafeExecuteJavaScript": true,
+        "enableRemoteModule": false,
+        "safeDialogs": false
+    },
+    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
+    "autoHideMenuBar": true,
+    "redirect":[],
+    "redirectURL":"",
+    "proxy":"",
+    "noCache": false,
+    "interceptor":[
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/auth",
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/tradepile",
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/trade/",
+        "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/auctionhouse"
+    ],
+    "preLoadFile": "<dir>/preLoadFile.js"
+}

File diff suppressed because it is too large
+ 0 - 0
dist/win-ia32-unpacked/preLoadFile.js


+ 32 - 0
dist/win-ia32-unpacked/preload.js

@@ -0,0 +1,32 @@
+const { contextBridge, ipcRenderer } = require('electron');
+
+
+
+// window.open = (url)=>{console.log(url)}
+window.lastText = ''
+window.lastText2 = ''
+
+
+
+contextBridge.exposeInMainWorld('electronAPI', {
+  openWindow: (msg) => ipcRenderer.invoke('openWindow', msg),
+  closeAllWindow: (msg) => ipcRenderer.send('closeAllWindow', msg),
+  getData: (msg) => ipcRenderer.send('getData', msg),
+  postData: (msg) => ipcRenderer.send('postData', msg),
+  setProxy: (msg) => ipcRenderer.send('setProxy', msg),
+  addPreLoadCode: (msg) => ipcRenderer.send('addPreLoadCode', msg),
+  setStoData: (msg) => ipcRenderer.send('setStoData', msg),
+  getStoData: (msg) => ipcRenderer.send('getStoData', msg),
+  closeWindow: (msg) => ipcRenderer.send('closeWindow', msg),
+  changeProxy: (msg) => ipcRenderer.send('changeProxy', msg),
+  readConfig: (msg) => ipcRenderer.send('readConfig', msg),
+  saveConfig: (msg) => ipcRenderer.send('saveConfig', msg),
+  setMaxWindowOpenNum: (msg) => ipcRenderer.send('setMaxWindowOpenNum', msg),
+  readdir: (msg) => ipcRenderer.send('readdir', msg),
+  download: (msg) => ipcRenderer.send('download', msg),
+  broadcast: (msg) => ipcRenderer.send('broadcast-message', msg),
+  saveFile: (msg) => ipcRenderer.invoke('saveFile', msg),
+  onBroadcast: (callback) => ipcRenderer.on('message-broadcast', (event, data) => callback(data))
+});
+
+

+ 2 - 0
dist/宜合道/config.json

@@ -18,6 +18,8 @@
     "proxy":"",
     "noCache": false,
     "interceptor":[
+        "https://a-dflapi.topxlc.com/dfl/web/get_plate_list",
+        "https://a-dflapi.topxlc.com/dfl/stock/second_line_detail_for_plate"
     ],
     "preLoadFile": "<dir>/preLoadFile.js"
 }

File diff suppressed because it is too large
+ 61 - 117
dist/宜合道/preLoadFile.js


+ 2 - 1
dist/抖音热榜/config.json

@@ -18,7 +18,8 @@
     "proxy":"",
     "noCache": false,
     "interceptor":[
-        "*://douhot.douyin.com/douhot/v1/material/video_billboard*"
+        "https://douhot.douyin.com/douhot/v1/material/video_billboard",
+        "data_trends/trends?option=9"
     ],
     "preLoadFile": "<dir>/preLoadFile.js"
 }

+ 46 - 3
dist/抖音热榜/preLoadFile.js

@@ -1,16 +1,47 @@
 // 监听拦截到的数据
 window.dataList = [
-  ["昵称","发布时间","ID","时长","粉丝","关注","关注率","喜欢","喜欢率","热度","标题"]
+  ["昵称","发布时间","ID","时长","粉丝","关注","关注率","喜欢","喜欢率","热度","标题","链接"]
 ]
+function timestampToDateTime(timestamp) {
+  // 将秒时间戳转换为毫秒(JavaScript Date 需要毫秒时间戳)
+  const date = new Date(timestamp * 1000);
+  
+  const year = date.getFullYear();
+  const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以要+1
+  const day = String(date.getDate()).padStart(2, '0');
+  const hours = String(date.getHours()).padStart(2, '0');
+  const minutes = String(date.getMinutes()).padStart(2, '0');
+  const seconds = String(date.getSeconds()).padStart(2, '0');
+  
+  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+}
 window.onInterceptedData = function (data) {
   window.systemInfo = data
   if (data.url.includes('https://douhot.douyin.com/douhot/v1/material/video_billboard')) {
     const dataTemp = JSON.parse(data.responseBody)
     console.log(dataTemp)
     dataTemp.data.objs.forEach(element => {
-      window.dataList.push([element.nick_name, element.publish_time, element.item_id, element.item_duration, element.fans_cnt, element.follow_cnt, element.follow_rate, element.like_cnt, element.like_rate, element.score, element.item_title])
+      window.dataList.push([element.nick_name, timestampToDateTime(element.publish_time), element.item_id, element.item_duration, element.fans_cnt, element.follow_cnt, element.follow_rate, element.like_cnt, element.like_rate, element.score, element.item_title, "https://www.douyin.com/jingxuan?modal_id=" + element.item_id])
     });
     loadData()
+  }
+  if (data.url.includes('data_trends/trends?option=9')) {
+    console.log(data)
+    const itemID = data.url.split('/')[6]
+    if (data.responseBody) {
+      const dataTemp = JSON.parse(data.responseBody)
+      console.log(dataTemp)
+      for (let index = 0; index < window.dataList.length; index++) {
+        const element = window.dataList[index];
+        if (window.dataList[index][2] == itemID) {
+          window.dataList[0] = window.dataList[0].concat(dataTemp.data.map((e)=>{return e.date}))
+          window.dataList[index] = window.dataList[index].concat(dataTemp.data.map((e)=>{return e.value}))
+        }
+      }
+    }
+    
+    
+
   }
 };
 
@@ -181,12 +212,24 @@ function logPanel (el, max) {
   }
 }
 
+function saveData2() {
+  for (let index = 1; index < window.dataList.length; index++) {
+    const element = window.dataList[index];
+    setTimeout(() => {
+      location.href='https://douhot.douyin.com/m/#/pages/video/detail/index?video_id=' + element[2]
+    }, 5 * index * 1000);
+  }
+  setTimeout(() => {
+      saveCSV ("output.csv", window.dataList)
+  }, 5 * (window.dataList.length) * 10000);
+}
+
 setTimeout(() => {
   if (document.querySelector('.puge-box')) document.querySelector('.puge-box').innerHTML = `
   <h5 style="color:black;" id="yhqd">已获取数据数量:0</h5>
   <div class="owo button" onclick="clearData();" style=" background-color: #009fe9; text-align: center; line-height: 40px; margin-bottom:2px;">清理数据</div>
   <div class="owo button" onclick="saveData();" style=" background-color: #009fe9; text-align: center; line-height: 40px; margin-bottom:2px;">导出数据</div>
-  
+  <div class="owo button" onclick="saveData2();" style=" background-color: #009fe9; text-align: center; line-height: 40px; margin-bottom:2px;">获取小时数据</div>
   `
 
 }, 2000);

+ 0 - 1
dist/抖音热榜/preload.js

@@ -25,7 +25,6 @@ contextBridge.exposeInMainWorld('electronAPI', {
   readdir: (msg) => ipcRenderer.send('readdir', msg),
   download: (msg) => ipcRenderer.send('download', msg),
   broadcast: (msg) => ipcRenderer.send('broadcast-message', msg),
-  // 保存文件
   saveFile: (msg) => ipcRenderer.invoke('saveFile', msg),
   onBroadcast: (callback) => ipcRenderer.on('message-broadcast', (event, data) => callback(data))
 });

+ 100 - 27
main.js

@@ -103,39 +103,109 @@ let preLoadCode = `
 `
 
 // 拦截数据
-function setupDebuggerInterceptor(webContents) {
+// 拦截数据(获取请求和响应内容)
+function setupDebuggerInterceptor(webContents, interceptor) {
   webContents.debugger.attach('1.3');
   
+  const pendingRequests = new Map();
+  
   webContents.debugger.on('message', (event, method, params) => {
+    // 存储请求信息
+    if (method === 'Network.requestWillBeSent') {
+      pendingRequests.set(params.requestId, {
+        url: params.request.url,
+        method: params.request.method,
+        headers: params.request.headers,
+        postData: params.request.postData,
+        timestamp: Date.now()
+      });
+    }
+    
+    // 响应接收时记录信息
     if (method === 'Network.responseReceived') {
       const { requestId, response } = params;
+      let hookData = false;
       
-      // 检查是否是目标URL
-      if (response.url.includes('video_billboard')) {
+      interceptor.forEach(hookURL => {
+        if (response.url.includes(hookURL) || response.url === hookURL) {
+          hookData = true;
+        }
+      });
+      
+      if (hookData) {
         console.log('拦截到响应:', response.url, response.status);
         
-        // 获取响应体(需要额外处理)
-        webContents.debugger.sendCommand('Network.getResponseBody', { requestId })
-          .then(({ body }) => {
-            const interceptedData = {
-              url: response.url,
-              statusCode: response.status,
-              responseBody: body,
-              headers: response.headers
-            };
-            console.log('hook data:')
-            console.log(interceptedData)
-            if (mainWindow && !mainWindow.isDestroyed()) {
-              mainWindow.webContents.executeJavaScript(`
-                if (window.onInterceptedData) {
-                  window.onInterceptedData(${JSON.stringify(interceptedData)});
+        // 存储响应信息,等待 loadingFinished
+        const requestInfo = pendingRequests.get(requestId) || {};
+        pendingRequests.set(requestId, {
+          ...requestInfo,
+          responseReceived: true,
+          response,
+          hookData: true
+        });
+      }
+    }
+    
+    // 在资源加载完成时获取响应体
+    if (method === 'Network.loadingFinished') {
+      const { requestId } = params;
+      const requestInfo = pendingRequests.get(requestId);
+      
+      if (requestInfo && requestInfo.hookData) {
+        // 延迟获取响应体,确保数据可用
+        setTimeout(() => {
+          webContents.debugger.sendCommand('Network.getResponseBody', { requestId })
+            .then(({ body }) => {
+              // 获取请求体(如果有)
+              let requestBody = null;
+              if (requestInfo.postData) {
+                try {
+                  // 尝试解析为JSON,如果不是JSON则保持原样
+                  requestBody = JSON.parse(requestInfo.postData);
+                } catch (e) {
+                  requestBody = requestInfo.postData;
                 }
-              `).catch(console.error);
-            }
-          })
-          .catch(console.error);
+              }
+              
+              const interceptedData = {
+                url: requestInfo.response.url,
+                method: requestInfo.method,
+                statusCode: requestInfo.response.status,
+                requestHeaders: requestInfo.headers,
+                requestBody: requestBody,
+                responseBody: body,
+                responseHeaders: requestInfo.response.headers,
+                requestId: requestId,
+                timestamp: requestInfo.timestamp
+              };
+              
+              console.log('拦截到的完整数据:', interceptedData.url);
+              console.log(interceptedData);
+              
+              if (mainWindow && !mainWindow.isDestroyed()) {
+                mainWindow.webContents.executeJavaScript(`
+                  if (window.onInterceptedData) {
+                    window.onInterceptedData(${JSON.stringify(interceptedData)});
+                  }
+                `).catch(console.error);
+              }
+              
+              // 清理缓存
+              pendingRequests.delete(requestId);
+            })
+            .catch(error => {
+              console.warn(`无法获取响应体 ${requestInfo.response.url}:`, error.message);
+              pendingRequests.delete(requestId);
+            });
+        }, 100); // 添加小延迟
       }
     }
+    
+    // 清理已完成或失败的请求
+    if (method === 'Network.loadingFailed' || method === 'Network.requestServedFromCache') {
+      const { requestId } = params;
+      pendingRequests.delete(requestId);
+    }
   });
 
   // 启用网络跟踪
@@ -170,15 +240,17 @@ function createWindow (partitionSession) {
   }
 
   if (webConfig.preLoadFile) {
-    console.log(`加载额外JS: ${webConfig.preLoadFile}`)
+    console.log(`Load additional JS: ${webConfig.preLoadFile}`)
     preLoadCode += fs.readFileSync(webConfig.preLoadFile, 'utf-8')
   }
   mainWindow.webContents.on("dom-ready", function() {
     mainWindow.webContents.executeJavaScript(preLoadCode);
   });
-  mainWindow.webContents.on("did-finish-load", function() {
+  // 只触发一次!
+  mainWindow.webContents.once("did-finish-load", function() {
     if (webConfig.interceptor && webConfig.interceptor.length > 0) {
-      setupDebuggerInterceptor(mainWindow.webContents);
+      console.log('Need to intercept data!')
+      setupDebuggerInterceptor(mainWindow.webContents, webConfig.interceptor);
     }
   });
   // 打开新窗口触发
@@ -462,8 +534,9 @@ ipcMain.handle("saveFile", async (event, message) => {
     // 构建完整的文件路径
     const filePath = path.join(downloadDir, message.filename);
     
-    // 保存文件内容
-    fs.writeFileSync(filePath, message.content);
+    // 添加UTF-8 BOM头并保存文件
+    const contentWithBOM = '\uFEFF' + message.content;
+    fs.writeFileSync(filePath, contentWithBOM, 'utf8');
     
     console.log('文件保存成功:', filePath);
     return { success: true, path: filePath };

+ 164 - 68
preLoadFile.js

@@ -1,20 +1,48 @@
+window.userSt = {}
 // 监听拦截到的数据
-window.dataList = [
-  ["昵称","发布时间","ID","时长","粉丝","关注","关注率","喜欢","喜欢率","热度","标题"]
-]
 window.onInterceptedData = function (data) {
-  
+  console.log(data)
   window.systemInfo = data
-  if (data.url.includes('https://douhot.douyin.com/douhot/v1/material/video_billboard')) {
-    const dataTemp = JSON.parse(data.responseBody)
-    console.log(dataTemp)
-    dataTemp.data.objs.forEach(element => {
-      window.dataList.push([element.nick_name, element.publish_time, element.item_id, element.item_duration, element.fans_cnt, element.follow_cnt, element.follow_rate, element.like_cnt, element.like_rate, element.score, element.item_title])
+  switch (data.url) {
+    case "https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/auth":
+      const result = JSON.parse(data.responseBody)
+      if (result.sid) {
+        window.activeID = result.sid
+        if (window.logBox) window.logBox.add('获取到认证ID:' + window.activeID)
+      }
+      
+      break;
+    default:
+      break;
+  }
+  if (data.url.includes('https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/auctionhouse')) {
+    console.log(data)
+    const result2 = data.requestBody
+    window.itemID = result2.itemData.id
+    if (window.logBox) window.logBox.add(`卖出物品:${window.itemID}`)
+    if (window.userSt[window.itemID]) {
+      window.logBox.add(`获取到物品ID:${window.userSt[window.itemID].assetId}`)
+      owoSocket.send("sell", {"id": window.itemID, "buyNowPrice": result2.buyNowPrice, "assetId": window.userSt[window.itemID].assetId})
+    } else {
+      window.logBox.add(`无法匹配物品:${window.itemID}`)
+    }
+
+  }
+  if (data.url.includes('https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/tradepile')) {
+    const result3 = JSON.parse(data.responseBody)
+    if (window.logBox) window.logBox.add(`获取到物品数量:${result3.auctionInfo.length}`)
+    result3.auctionInfo.forEach(element => {
+      window.userSt[element.itemData.id] = element.itemData
     });
-    loadData()
+  }
+  if (data.url.includes('https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/trade/') && data.url.includes('/bid')) {
+    const result4 = JSON.parse(data.responseBody)
+    if (window.logBox) window.logBox.add(`买入物品:${result4.auctionInfo[0].tradeId}`)
+    window.userSt[result4.auctionInfo[0].itemData.id] = result4.auctionInfo[0].itemData
   }
 };
 
+
 let owoLoadList = []
 function loadCSS (url) {
     if (owoLoadList.includes(url)) {
@@ -72,60 +100,6 @@ if (!box[0]) {
   document.body.appendChild(insertElement);
 }
 
-function clearData() {
-  window.dataList = [
-    ["昵称","发布时间","ID","时长","粉丝","关注","关注率","喜欢","喜欢率","热度","标题"]
-  ]
-  loadData()
-}
-
-function loadData() {
-  window.yhqd.innerText = `已获取数据数量:${window.dataList.length - 1}`
-}
-
-// 保存CSV
-function fake_click(obj) {
-  var ev = document.createEvent("MouseEvents");
-  ev.initMouseEvent(
-      "click", true, false, window, 0, 0, 0, 0, 0
-      , false, false, false, false, 0, null
-      );
-  obj.dispatchEvent(ev);
-}
-function download(name, data) {
-  var urlObject = window.URL || window.webkitURL || window;
-
-  var downloadData = new Blob([data]);
-
-  var save_link = document.createElementNS("http://www.w3.org/1999/xhtml", "a")
-  save_link.href = urlObject.createObjectURL(downloadData);
-  save_link.download = name;
-  fake_click(save_link);
-}
-
-function saveCSV (name, data) {
-  let saveData = ''
-  data.forEach(element => {
-    if (element) {
-      saveData += element.join(',')
-      saveData += '\r\n'
-    }
-  });
-  
-  var urlObject = window.URL || window.webkitURL || window;
-  
-  var downloadData = new Blob(['\ufeff' + saveData], { type: 'text/csv,charset=UTF-8'});
-
-  var save_link = document.createElementNS("http://www.w3.org/1999/xhtml", "a")
-  save_link.href = urlObject.createObjectURL(downloadData);
-  save_link.download = name;
-  fake_click(save_link);
-}
-
-
-function saveData() {
-  saveCSV ("output.csv", window.dataList)
-}
 
 function owostart () {
     const box = document.getElementsByClassName('puge-box')[0]
@@ -183,11 +157,133 @@ function logPanel (el, max) {
 
 setTimeout(() => {
   if (document.querySelector('.puge-box')) document.querySelector('.puge-box').innerHTML = `
-  <h5 style="color:black;" id="yhqd">已获取数据数量:0</h5>
-  <div class="owo button" onclick="clearData();" style=" background-color: #009fe9; text-align: center; line-height: 40px; margin-bottom:2px;">清理数据</div>
-  <div class="owo button" onclick="saveData();" style=" background-color: #009fe9; text-align: center; line-height: 40px; margin-bottom:2px;">导出数据</div>
+  <div class="owo button" onclick="window.running=true;window.logBox.add('已开启下单');" style=" background-color: #009fe9; text-align: center; line-height: 40px; ">开始接收</div>
+  <div class="owo button" onclick="window.running=false;window.logBox.add('已关闭下单');" style=" background-color: #009fe9; text-align: center; line-height: 40px; ">停止接收</div>
+  <h5 style="color:black;">日志输出</h5>
+  <div class="log-panel" style="height:300px;background-color: darkcyan;"></div>
   
   `
-
+  setTimeout(() => {
+    window.logBox = new logPanel(document.querySelector('.log-panel'))
+  }, 0);
 }, 2000);
 
+
+function owoSocket(typeStr, options) {
+  const that = this
+  this.type = typeStr
+  let timeConnect = 0;
+
+  function reconnect(callBack) {
+    timeConnect++;
+    console.log("第" + timeConnect + "次重连");
+    // 普通连接
+    that.ws = new WebSocket('wss://ws.lamp.run')
+    that.ws.addEventListener('open', function (event) {
+      that.ws.send(JSON.stringify({"route": "login", "type": typeStr, "admin": options.isAdmin, "id": options.id}))
+      if (callBack) callBack()
+      if (options.onOpen) options.onOpen(that.ws)
+    })
+
+
+    that.ws.onerror = function () {
+      console.error('服务器已经断开');
+      // 进行重连
+      setTimeout(function () {
+        reconnect();
+      }, 3000)
+    };
+    that.ws.addEventListener('message', function (event) {
+      const mess = JSON.parse(event.data)
+      if (mess.type === 'userInfo') {
+        that.wsUserInfo = mess.value
+        if (options.onReady) options.onReady(that.ws)
+      } else {
+        if (options.messageCallBack) options.messageCallBack(mess)
+      }
+    })    
+  }
+
+  reconnect()
+  this.send = function (route, value, sendTo) {
+    // 先判断连接是否关闭 如果关闭先重新连接
+    if (that.ws.readyState === 3) {
+      console.error('ws连接已断开正在重连!')
+      reconnect(()=> {
+        that.ws.send(JSON.stringify({"route": route, "type": typeStr, "userID": that.wsUserInfo.userID, "id": sendTo, "value": value}))
+      })
+    } else {
+      that.ws.send(JSON.stringify({"route": route, "type": typeStr, "userID": that.wsUserInfo.userID, "id": sendTo, "value": value}))
+    }
+    
+  }
+}
+
+
+function searchItem(itemInfo, callBack) {
+  // 查找ID
+  window.logBox.add(`查找卡片:${itemInfo.assetId}`)
+  // window.logBox.add(`开始购买:${JSON.stringify(playerInfo)}`)
+  fetch(`https://utas.mob.v4.prd.futc-ext.gcp.ea.com/ut/game/fc26/transfermarket?num=21&start=0&type=player&maskedDefId=${itemInfo.assetId}&maxb=${itemInfo.buyNowPrice}`, {
+    "headers": {
+      "accept": "*/*",
+      "accept-language": "zh-CN",
+      "content-type": "application/json",
+      "x-ut-sid": window.activeID
+    },
+    "referrer": "https://www.ea.com/",
+    "body": null,
+    "method": "GET",
+  }).then((response) => response.json())
+    .then((result) => {
+      let resp = '搜索到列表:'
+      result.auctionInfo.forEach(element => {
+        resp += `[${element.itemData.id}]`
+        if(element.itemData.id == itemInfo.id) {
+          callBack(element.tradeId)
+          return
+        }
+      });
+      window.logBox.add(resp)
+    })
+    .catch((error) => console.error(error));
+  
+}
+
+let wsOptions = {
+  isAdmin: true,
+  onReady: () => {
+  }
+}
+wsOptions.messageCallBack = (meg) => {
+  console.log(meg);
+  window.logBox.add(JSON.stringify(meg))
+  if (window.running) {
+    searchItem(meg.value, (tradeId) => {
+      window.logBox.add(`下单购买:${tradeId}`)
+      fetch(`https://utas.mob.v5.prd.futc-ext.gcp.ea.com/ut/game/fc26/trade/${tradeId}/bid`, {
+        "headers": {
+          "accept": "*/*",
+          "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
+          "content-type": "application/json",
+          "x-ut-sid": window.activeID
+        },
+        "referrer": "https://www.ea.com/",
+        "body": JSON.stringify({"bid": meg.value.buyNowPrice}),
+        "method": "PUT",
+        "mode": "cors",
+        "credentials": "omit"
+      }).then((response) => response.text())
+      .then((result) => {
+        if (result.includes('auctionInfo')) {
+          window.logBox.add(`${meg.value.id}购买成功!`)
+          return
+        }
+        window.logBox.add(result)
+      })
+      .catch((error) => console.error(error));
+    })
+    
+  }
+}
+window.owoSocket = new owoSocket('eaGame', wsOptions)

Some files were not shown because too many files changed in this diff