Code Monkey home page Code Monkey logo

imaotai's Introduction

i茅台预约脚本

原理:

1、登录获取验证码

2、输入验证码获取TOKEN

3、获取当日SESSION ID

4、根据配置文件预约CONFIG文件中,所在城市的i茅台商品

使用:

1、安装依赖

pip3 install --no-cache-dir -r requirements.txt

2、(可选)修改config.py

ITEM_MAP = {
    "10213": "53%vol 500ml贵州茅台酒(癸卯兔年)",
    "10214": "53%vol 375ml×2贵州茅台酒(癸卯兔年)",
    "10056": "53%vol 500ml茅台1935",
    "2478": "53%vol 500ml贵州茅台酒(珍品)"
}

# 需要预约的商品(默认只预约2个兔茅)
########################
ITEM_CODES = ['10213', '10214']

# 弃用掉了邮箱推送,很多人不会使用
# push plus 微信推送,具体使用参考  https://www.pushplus.plus
# 例如: PUSH_TOKEN = '123456'
########################
# 不填不推送消息,一对一发送
PUSH_TOKEN = '123456'
########################

# credentials 路径,例如:CREDENTIALS_PATH = /home/user/.imoutai/credentials
# 不配置,使用默认路径,在宿主目录
# 例如: CREDENTIALS_PATH = '/home/user/.imautai/credentials'
########################
CREDENTIALS_PATH = None
########################

# 预约规则配置
########################
# 预约本市出货量最大的门店
MAX_ENABLED = True
# 预约你的位置附近门店
DISTANCE_ENABLED = False
########################

3、按提示输入 预约位置、手机号、验证码 等,生成的token等 配置文件会保存在 $HOME/.imaotai/credentials, 很长时间不再需要登录。支持多账号

mobian@mobian:~/app/imaotai$ python3 login.py

请输入你的位置,例如[小区名称],为你预约本市门店商店: 军安家园
0 : [地区:内蒙古自治区,位置:内蒙古自治区赤峰市红山区军安家园]
请选择位置序号,重新输入请输入[-]:0
已选择 地区:北京市,[北京市海淀区上地十街]附近的门店
输入手机号[13812341234]:1861164****
输入 [1861164****] 验证码[1234]:1234
是否继续添加账号[Y/N]:n
mobian@mobian:~/app/imaotai$ cat ~/.imaotai/credentials 
[1850006****]
city = 西安市
token = zF3viZiQyUeYb5i4dxAhcBWguXS5VFYUPS5Di7BdsLs
userid = 106944****
province = 陕西省
lat = 45.042259
lng = 115.344116

[1863637****]
city = 北京市
token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9
userid = 1102514****
province = 北京市
lat = 45.042259
lng = 115.344116

[1861164****]
city = 太原市
token = 6INvrtyGOTdpsvFmiw0I4FoFNDyG-ekt2WFsQsU9nBU
userid = 10677****
province = 山西省
lat = 45.042259
lng = 115.344116

4、python3 main.py ,执行预约操作

python3 main.py

注意:

1、可以配置一个定时任务,执行每日自动预约,建议每天多执行2次

2、注意服务器的时区是UTC+8,**区域

# imaotai
10,40,50 9 * * * root python3 /home/mobian/app/imaotai/main.py >> /var/log/imaotai.log




Thank you to JetBrains for supporting open source projects:

JetBrains

以上内容为原文件提供者更新,以下是个人说明。

上面写的方法当然是通用的,但是在docker内使用有一定的区别,第一步要订阅同步一下脚本到你的服务器里,青龙面板主界面订阅添加 https://github.com/gerenyongcangku/imaotai.git ,定时随意执行一次,然后删掉系统自动配置的5个定时脚本。然后用软件连接到你的服务器,这个看个人喜好及常用工具,执行docker exec -it *** bash 这个命令进入到容器内,***是你当初安装容器时候定义的名字,我的容器就是QL,所以执行的是 docker exec -it QL bash 。然后执行 cd data/scripts/gerenyongcangku_imaotai/ 进入到imaotai的目录内,可以导入自己脚本,改最后的相应位置。 先执行 python login.py进行账号配置,然后返回青龙主界面定时任务处添加定时任务,task gerenyongcangku_imaotai/main.py,同理目录名记得同步更新,添加定时任务时间不要太集中靠前,毕竟同时人太多了有失败风险,还怕失败可以多定义2次。push推送记得看,cookie不是长期有效的。查看修改青龙下存储的账号,目录变更, cat /root/.imaotai/credentials

imaotai's People

Contributors

gerenyongcangku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

imaotai's Issues

config.py

更改成就近点预约保存之后,会自动变成出货量最大的门店预约,不知道为何保存后会自动变回来

登录时,输入小区名称后无法继续往下执行,返回KeyError: 'geocodes'

root@Others:/ql/data/scripts/gerenyongcangku_imaotai $ python login.py

请输入你的位置,例如[小区名称],为你自动预约附近的门店:碧桂园
Traceback (most recent call last):
File "/ql/data/scripts/gerenyongcangku_imaotai/login.py", line 55, in
location_select: dict = get_location()
^^^^^^^^^^^^^^
File "/ql/data/scripts/gerenyongcangku_imaotai/login.py", line 33, in get_location
selects = process.select_geo(location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ql/data/scripts/gerenyongcangku_imaotai/process.py", line 261, in select_geo
geocodes: list = resp.json()['geocodes']
~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'geocodes'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.