感谢@sitoio 大佬的付出

注意:教程略微复杂,请耐心配置。

脚本是申购,不是抢购,申购成功不一定必中,万一中了的会有短信通知。

目前只会申购以下两款茅台

53%vol 500ml贵州茅台酒(甲辰龙年)

53%vol 375ml×2贵州茅台酒(甲辰龙年)

第一步 安装依赖

在依赖管理-Linux中安装依赖

gcc g++ make libffi-dev openssl-dev

在依赖管理-Python中安装依赖

dailycheckin

第二步 填写配置文件

我们打开高德开放平台 https://console.amap.com/dev/key/app

自己注册完到应用管理 添加个应用 随便添加即可。然后按图操作

把这里的Key保存好。

接下来运行Python文件获取key,用网页在线平台https://lightly.teamcode.com/dashboard

新建一个Python项目将以下内容复制到main.py,复制完后将刚刚申请的KEY填写进去保存

import hashlib
import json
import time
 
import requests
 
 
"""
获取地点信息,这里用的高德 api,需要自己去高德开发者平台申请自己的 key
"""
AMAP_KEY = ""
 
 
 
 
SALT = "2af72f100c356273d46284f6fd1dfc08"
 
CURRENT_TIME = str(int(time.time() * 1000))
headers = {}
 
 
mt_version = json.loads(
    requests.get("https://itunes.apple.com/cn/lookup?id=1600482450").text
)["results"][0]["version"]
 
 
header_context = """
MT-Lat: 28.499562
MT-K: 1675213490331
MT-Lng: 102.182324
Host: app.moutai519.com.cn
MT-User-Tag: 0
Accept: */*
MT-Network-Type: WIFI
MT-Token: 1
MT-Team-ID: 1
MT-Info: 028e7f96f6369cafe1d105579c5b9377
MT-Device-ID: 2F2075D0-B66C-4287-A903-DBFF6358342A
MT-Bundle-ID: com.moutai.mall
Accept-Language: en-CN;q=1, zh-Hans-CN;q=0.9
MT-Request-ID: 167560018873318465
MT-APP-Version: 1.3.7
User-Agent: iOS;16.3;Apple;?unrecognized?
MT-R: clips_OlU6TmFRag5rCXwbNAQ/Tz1SKlN8THcecBp/HGhHdw==
Content-Length: 93
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: application/json
userId: 2
"""
 
 
# 初始化请求头
def init_headers(
    user_id: str = "1", token: str = "2", lat: str = "29.83826", lng: str = "119.74375"
):
    for k in header_context.strip().split("\n"):
        temp_l = k.split(": ")
        dict.update(headers, {temp_l[0]: temp_l[1]})
    dict.update(headers, {"userId": user_id})
    dict.update(headers, {"MT-Token": token})
    dict.update(headers, {"MT-Lat": lat})
    dict.update(headers, {"MT-Lng": lng})
    dict.update(headers, {"MT-APP-Version": mt_version})
 
 
# 用高德api获取地图信息
def select_geo(i: str):
    # 校验高德api是否配置
    if AMAP_KEY is None:
        print("!!!!请配置 AMAP_KEY (高德地图的MapKey)")
        raise ValueError
    resp = requests.get(
        f"https://restapi.amap.com/v3/geocode/geo?key={AMAP_KEY}&output=json&address={i}"
    )
    geocodes: list = resp.json()["geocodes"]
    return geocodes
 
 
def signature(data: dict):
    keys = sorted(data.keys())
    temp_v = ""
    for item in keys:
        temp_v += data[item]
    text = SALT + temp_v + CURRENT_TIME
    hl = hashlib.md5()
    hl.update(text.encode(encoding="utf8"))
    md5 = hl.hexdigest()
    return md5
 
 
# 获取登录手机验证码
def get_vcode(mobile: str):
    params = {"mobile": mobile}
    md5 = signature(params)
    dict.update(
        params, {"md5": md5, "timestamp": CURRENT_TIME, "MT-APP-Version": mt_version}
    )
    responses = requests.post(
        "https://app.moutai519.com.cn/xhr/front/user/register/vcode",
        json=params,
        headers=headers,
    )
    if responses.status_code != 200:
        print(
            f"get v_code : params : {params}, response code : {responses.status_code}, response body : {responses.text}"
        )
 
 
# 执行登录操作
def login(mobile: str, v_code: str):
    params = {"mobile": mobile, "vCode": v_code, "ydToken": "", "ydLogId": ""}
    md5 = signature(params)
    dict.update(
        params, {"md5": md5, "timestamp": CURRENT_TIME, "MT-APP-Version": mt_version}
    )
    responses = requests.post(
        "https://app.moutai519.com.cn/xhr/front/user/register/login",
        json=params,
        headers=headers,
    )
    if responses.status_code != 200:
        print(
            f"login : params : {params}, response code : {responses.status_code}, response body : {responses.text}"
        )
    dict.update(headers, {"MT-Token": responses.json()["data"]["token"]})
    dict.update(headers, {"userId": responses.json()["data"]["userId"]})
    return responses.json()["data"]["token"], responses.json()["data"]["userId"]
 
 
def get_location():
    while 1:
        location = input("请输入精确小区位置,例如[小区名称],为你自动预约附近的门店:").strip()
        selects = select_geo(location)
 
        a = 0
        for item in selects:
            formatted_address = item["formatted_address"]
            province = item["province"]
            print(f"{a} : [地区:{province},位置:{formatted_address}]")
            a += 1
        user_select = input("请选择位置序号,重新输入请输入[-]:").strip()
        if user_select == "-":
            continue
        select = selects[int(user_select)]
        formatted_address = select["formatted_address"]
        province = select["province"]
        print(f"已选择 地区:{province},[{formatted_address}]附近的门店")
        return select

if __name__ == "__main__":
    items = []
    while 1:
        init_headers()
        location_select: dict = get_location()
        province = location_select["province"]
        city = location_select["city"]
        location: str = location_select["location"]
 
        mobile = input("输入手机号[13888888888]:").strip()
        get_vcode(mobile)
        code = input(f"输入 [{mobile}] 验证码[1234]:").strip()
        token, userId = login(mobile, code)
        item = {
            "city": str(city),
            "lat": location.split(",")[1],
            "lng": location.split(",")[0],
            "mobile": str(mobile),
            "province": province,
            "token": str(token),
            "userid": str(userId),
        }
        items.append(item)
        condition = input("是否继续添加账号[y/n]:").strip()
        with open("account.json", "w") as f:
            f.write(json.dumps(items, ensure_ascii=False, indent=4))
        if condition.lower() == "n":
            break

然后打开终端 输入

pip install requests~=2.31.0 pycryptodome==3.17

等待完成后点击运行

按终端提示输入完成后即可。参数会自动保存在account.json中

然后我们打开青龙-脚本管理-➕

按图片新建好文件,将配置文件示例添加进去。

配置文件示例

{
  "BARK_URL": "",
  "COOLPUSHEMAIL": true,
  "COOLPUSHQQ": true,
  "COOLPUSHSKEY": "",
  "COOLPUSHWX": true,
  "DINGTALK_ACCESS_TOKEN": "",
  "DINGTALK_SECRET": "",
  "FSKEY": "",
  "PUSHPLUS_TOKEN": "",
  "PUSHPLUS_TOPIC": "",
  "QMSG_KEY": "",
  "QMSG_TYPE": "",
  "QYWX_AGENTID": "",
  "QYWX_CORPID": "",
  "QYWX_CORPSECRET": "",
  "QYWX_KEY": "",
  "QYWX_MEDIA_ID": "",
  "QYWX_TOUSER": "",
  "SCKEY": "",
  "SENDKEY": "",
  "TG_API_HOST": "",
  "TG_BOT_TOKEN": "",
  "TG_PROXY": "",
  "TG_USER_ID": "",
  "MERGE_PUSH": "",

  "IMAOTAI": [
		{
        "city": "",
        "lat": "",
        "lng": "",
        "mobile": "",
        "province": "",
        "token": "",
        "userid": ""
    },
    {
      "city": "多账号 城市",
      "lat": "多账号 纬度",
      "lng": "多账号 经度",
      "mobile": "多账号 手机号",
      "province": "多账号 省份",
      "token": "多账号 token",
      "userid": "多账号 用户 id",
      "reserve_rule": 0
    }
  ]
}

将刚刚account.json获取的参数添加到iMaotai类目下 可添加多个账号。

只有一个账号就把下面的删掉就行。

第三步 新建任务

任务按图输入即可。

task dailycheckin

教程到这里就结束了。

PS:@sitoio 大佬的项目还可以签到很多别的软件,大家有兴趣可以去他github看看 https://sitoi.github.io/dailycheckin/