首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >货拉拉秒抢订单软件,货拉拉抢单脚本插件,货拉拉接单神器最新版

货拉拉秒抢订单软件,货拉拉抢单脚本插件,货拉拉接单神器最新版

原创
作者头像
用户11701393
发布2025-06-23 13:47:34
发布2025-06-23 13:47:34
7281
举报

下载地址:https://www.pan38.com/share.php?code=pvvmX 提取码:8888 【仅供学习参考】

一、技术实现原理

本系统通过Python模拟人工操作流程,结合反检测技术实现高效抢单。核心模块包括:

  1. 自动化登录模块(模拟官方APP通信协议)
  2. 订单监听模块(WebSocket实时监听)
  3. 智能筛选模块(基于距离/价格的决策树)
  4. 反封禁模块(随机延迟+设备指纹伪装)

二、完整代码实现

代码语言:javascript
复制
import requests
import websocket
import json
import time
import random
from fake_useragent import UserAgent
from adevice_info import generate_device_fingerprint

class HuolalaAutoGrab:
    def __init__(self):
        self.session = requests.Session()
        self.ws_url = "wss://api.huolala.cn/ws/v3/order_push"
        self.base_url = "https://api.huolala.cn/v5"
        self.device_info = generate_device_fingerprint()
        self.ua = UserAgent()
        self.headers = {
            'User-Agent': self.ua.random,
            'X-Device-ID': self.device_info['device_id'],
            'X-Client-Version': '7.0.84'
        }
        
    def login(self, username, password):
        """模拟登录获取token"""
        login_url = f"{self.base_url}/driver/login"
        payload = {
            'mobile': username,
            'password': password,
            'device_type': 'android',
            'device_id': self.device_info['device_id']
        }
        try:
            response = self.session.post(login_url, json=payload, headers=self.headers)
            if response.status_code == 200:
                data = response.json()
                self.token = data['data']['token']
                self.headers['Authorization'] = f"Bearer {self.token}"
                return True
            return False
        except Exception as e:
            print(f"登录异常: {str(e)}")
            return False
    
    def start_websocket(self):
        """建立WebSocket长连接"""
        def on_message(ws, message):
            order_data = json.loads(message)
            if order_data.get('type') == 'NEW_ORDER':
                self.process_order(order_data['data'])
                
        def on_error(ws, error):
            print(f"WS错误: {error}")
            time.sleep(5)
            self.reconnect_ws()
            
        self.ws = websocket.WebSocketApp(
            self.ws_url,
            header=self.headers,
            on_message=on_message,
            on_error=on_error
        )
        self.ws.run_forever()
    
    def process_order(self, order):
        """订单处理逻辑"""
        if self.filter_order(order):
            grab_url = f"{self.base_url}/orders/{order['id']}/grab"
            delay = random.uniform(0.3, 1.2)  # 随机延迟防检测
            time.sleep(delay)
            response = self.session.post(grab_url, headers=self.headers)
            if response.status_code == 200:
                print(f"抢单成功! 订单ID: {order['id']}")
            else:
                print(f"抢单失败: {response.text}")
    
    def filter_order(self, order):
        """智能订单筛选"""
        MIN_PRICE = 50  # 最低接单价格
        MAX_DISTANCE = 15  # 最远接单距离(km)
        
        if (order['price'] >= MIN_PRICE and 
            order['distance'] <= MAX_DISTANCE and
            '加急' in order.get('tags', [])):
            return True
        return False
    
    def reconnect_ws(self):
        """断线重连机制"""
        while True:
            try:
                self.start_websocket()
                break
            except Exception as e:
                print(f"重连失败: {e}")
                time.sleep(10)

if __name__ == "__main__":
    bot = HuolalaAutoGrab()
    if bot.login("您的账号", "您的密码"):
        print("登录成功,开始监听订单...")
        bot.start_websocket()
    else:
        print("登录失败,请检查账号密码")

三、关键技术说明

  1. 设备指纹伪装:通过generate_device_fingerprint()生成唯一设备标识,规避平台检测
  2. 随机延迟算法:采用0.3-1.2秒的随机延迟模拟人工操作间隔
  3. 订单筛选策略:基于价格、距离、订单标签的多维度决策
  4. 长连接保持:WebSocket实现订单推送的实时监听
代码语言:txt
复制

// 常量定义区域
const APP_PACKAGE = "com.huolala.client";
const MIN_PRICE = 45;  // 最低接受价格
const MAX_DISTANCE = 12; // 最大接单距离(km)
const SCAN_INTERVAL = 800; // 订单扫描间隔(ms)
const VERSION = "7.0.85"; // 模拟APP版本

// 设备信息模拟
function generateDeviceInfo() {
  return {
    deviceId: device.getAndroidId() + "_" + random(1000,9999),
    model: device.model.replace(/\s+/g, "_"),
    imei: random(100000000000000, 999999999999999).toString(),
    androidVersion: "10.0.0"
  };
}

// 主控制类
class HuolalaAutoGrabber {
  constructor() {
    this.deviceInfo = generateDeviceInfo();
    this.lastOrderTime = 0;
    this.isRunning = false;
    this.filterKeywords = ["加急", "长途", "大件"];
    this.blackAreas = ["浦东机场", "虹桥枢纽"];
  }

  // 启动主逻辑
  start() {
    this.isRunning = true;
    this.prepareEnvironment();
    this.mainLoop();
  }

  // 环境准备
  prepareEnvironment() {
    this.ensureAppForeground();
    this.closePopupWindows();
    this.initScreenParams();
  }

  // 主循环
  mainLoop() {
    while (this.isRunning) {
      try {
        this.scanOrders();
        this.randomDelay();
      } catch (e) {
        log("主循环异常:" + e);
        this.recoverFromCrash();
      }
    }
  }

  // 订单扫描核心逻辑
  scanOrders() {
    const orders = this.findOrdersOnScreen();
    if (!orders || orders.length === 0) return;
    
    orders.forEach(order => {
      if (this.shouldGrabOrder(order)) {
        this.grabOrder(order);
      }
    });
  }

  // 查找屏幕上的订单
  findOrdersOnScreen() {
    const orders = [];
    const orderCards = className("android.view.View")
      .depth(15)
      .filter(c => c.bounds().width() > 800 && c.bounds().height() > 200);
    
    orderCards.forEach(card => {
      try {
        const textNodes = card.find(className("android.widget.TextView"));
        const order = this.parseOrderInfo(textNodes);
        if (order) orders.push(order);
      } catch (e) {
        log("订单解析异常:" + e);
      }
    });
    
    return orders;
  }

  // 解析订单信息
  parseOrderInfo(nodes) {
    const order = {};
    nodes.forEach(node => {
      const text = node.text();
      if (text.includes("¥")) {
        order.price = parseFloat(text.replace("¥", ""));
      } else if (text.includes("公里")) {
        order.distance = parseFloat(text.replace("公里", ""));
      } else if (text.includes("发货地")) {
        order.from = text.replace("发货地:", "").trim();
      } else if (text.includes("收货地")) {
        order.to = text.replace("收货地:", "").trim();
      } else if (text.match(/[0-9]{2}:[0-9]{2}/)) {
        order.time = text;
      }
    });
    
    if (!order.price || !order.distance) return null;
    order.element = nodes[0].parent();
    return order;
  }

  // 订单筛选逻辑
  shouldGrabOrder(order) {
    // 基础条件检查
    if (order.price < MIN_PRICE) return false;
    if (order.distance > MAX_DISTANCE) return false;
    
    // 黑名单区域检查
    for (const area of this.blackAreas) {
      if (order.from.includes(area) || order.to.includes(area)) {
        return false;
      }
    }
    
    // 关键词匹配
    const hasKeyword = this.filterKeywords.some(kw => 
      order.from.includes(kw) || order.to.includes(kw)
    );
    
    return hasKeyword;
  }

  // 执行抢单操作
  grabOrder(order) {
    const now = new Date().getTime();
    if (now - this.lastOrderTime < 2000) {
      log("操作频率限制,等待...");
      return;
    }
    
    try {
      order.element.click();
      sleep(random(300, 800));
      
      // 确认订单按钮
      const confirmBtn = text("立即抢单")
        .clickable()
        .findOne(1000);
      
      if (confirmBtn) {
        confirmBtn.click();
        this.lastOrderTime = now;
        log("抢单成功: " + JSON.stringify(order));
      }
    } catch (e) {
      log("抢单失败:" + e);
    }
  }

  // 其他辅助方法...
  randomDelay() { sleep(random(SCAN_INTERVAL-200, SCAN_INTERVAL+200)); }
  
  ensureAppForeground() {
    if (!currentPackage().equals(APP_PACKAGE)) {
      launch(APP_PACKAGE);
      sleep(3000);
    }
  }
  
  closePopupWindows() {
    const closeBtns = descMatches("关闭|取消|知道了")
      .clickable()
      .find();
    closeBtns.forEach(btn => btn.click());
  }
  
  initScreenParams() {
    setScreenMetrics(1080, 2340);
  }
  
  recoverFromCrash() {
    this.ensureAppForeground();
    this.closePopupWindows();
    sleep(5000);
  }
}

// 脚本入口
function main() {
  auto.waitFor();
  const grabber = new HuolalaAutoGrabber();
  grabber.start();
}

// 执行主函数
module.exports = main;
代码语言:txt
复制
// 随机数生成
function random(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

// 增强型元素查找
function enhancedFind(selector, timeout) {
  const endTime = Date.now() + (timeout || 1000);
  while (Date.now() < endTime) {
    const element = selector.findOne(10);
    if (element) return element;
    sleep(10);
  }
  return null;
}

// 屏幕坐标点击
function preciseClick(x, y) {
  press(x, y, random(80, 120));
}

// 滑动模拟
function humanSwipe(x1, y1, x2, y2) {
  const steps = random(15, 25);
  const duration = random(300, 800);
  swipe(x1, y1, x2, y2, duration);
}

// 日志记录
function log(msg) {
  console.log(`[${new Date().toLocaleString()}] ${msg}`);
  if (device.sdkInt >= 24) {
    files.append("./huolala.log", msg + "\n");
  }
}

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、技术实现原理
  • 二、完整代码实现
  • 三、关键技术说明
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档