Git Product home page Git Product logo

qiangcai's Introduction

QiangCai

上海疫情被封在家,开始抢菜之路,可以开启多台设备同时抢菜(理论上稍加修改,即可在任何APP上抢购任何商品,请勿滥用).
个人微信:sxsuccess,加时请说明来意,否则不通过。
看一下效果: (因为我有两个安卓手机,又另外开了一个安卓虚拟机,所以就是下面效果了,速度没有图中那么快,正常1-3s点击一次)

使用说明:
远程协助软件地址:https://www.todesk.com/download.html

上海现在抢菜之苦,真的有口说不出,每天早上6点,6点半,8点半,体验过的人的都知道,即便手速再快,还是抢不到..... 然后就有了下面的抢菜程序,完全由Python实现,并会附上教程:(兼容mac和windows平台,抢成功后会播放声音提醒)

一.安装环境

安装python3环境:
Mac电脑:
如果没有brew,先安装brew:

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

然后再执行:

brew install python

Windows电脑:
windows10以上下载链接: https://wwd.lanzouf.com/i6AEm02zzppi  (安装的时候记得勾选 add python to path) windows7以上下载链接: https://wwd.lanzouf.com/i55kC02zzqsh (安装的时候记得勾选 add python to path)

进入QiangCai文件夹,并安装依赖: 或者pip3

pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

或者:

pip install playsound -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --pre -U uiautomator2

adb:您可以转到[官方文档](https://developer.android.com/studio/command-line/adb)
mac电脑adb安装:

brew install android-platform-tools  

windows adb安装:
下载链接:https://wwd.lanzouf.com/iQWJT02zyz0h
1.解压
解压到任意目录,例如我都放在D:\Program Files文件夹下面
这样adb的目录就是D:\Program Files\platform-tools
2.添加环境变量
此电脑->系统属性->高级系统设置->环境变量->系统变量->Path->添加->D:\Program Files\platform-tools
(如果不想装adb,在项目的sources目录下带有win和mac的adb依赖,直接进入文件夹,运行adb也行。但不保证兼容每个设备)
安卓手机:安卓手机一部或者多部,或者安卓虚拟机一个或者多个,安装有美团外卖或者叮咚买菜
美团外卖下载:https://wwd.lanzouf.com/iGVRg031d9sf
叮咚买菜下载:https://wwd.lanzouf.com/izLDB0362tja

二.调试环境

现将手机和电脑链接。当安卓手机和电脑连接之后,再输入:
adb:adb安装成功后,在命令行输入adb,会出现以下提示: adb start-server:启动服务
adb devices:查看连接的设备列表
adb devices,就可以看到设备编号,记住这个编号,后面有用。
强烈推荐使用安卓虚拟机网易MUMU,官网地址:https://mumu.163.com/mac/index.html (如果用的安卓虚拟机,需要注意:开启root权限,然后执行:adb kill-server,然后再执行:adb start-server,再执行:adb devices,才会显示设备列表)
设备上安装atx-agent:或者python3

python -m uiautomator2 init 

会在安卓设备上自动安装一个依赖ATX软件:

三.开始抢菜

打开美团买菜,并进入购物车页面,确认购物车里是有商品的:(没有商品肯定是不行的,对吧)

用记事本打开main.py,修改源代码中的设备编码(改为你自己的,adb devices命令执行后得到的结果中的):

1.开始美团APP代码:
下载美团APP,进入美团买菜入口,然后进入购物车页面,运行下面代码,输入编号2即可

python main.py
或者python3 main.py

2.开始美团买菜APP代码:
下载美团买菜,然后进入购物车页面,运行下面代码,输入编号3即可

python main.py
或者python3 main.py

3.开始叮咚APP抢菜:
下载叮咚买菜,然后进入购物车页面,运行下面代码,输入编号1即可

python main.py
或者
python3 main.py

多设备运行:
复制meituan.py 或者dingdong.py,修改复制文件中的设备编号,然后执行开始程序即可。

最后看一下成果: (因为我有两个安卓手机,又另外开了一个安卓虚拟机,所以就是下面效果了,速度没有图中那么快,正常1-3s点击一次)

再展示一下抢到的菜吧,同时祝大家早日抢到自己喜欢的菜吧,也希望疫情赶紧结束:

常见问题汇总:

1.使用网易的mumu模拟器过程中发现不能正常获取设备码。 通过执行adb connect 127.0.0.1:7555 (7555是模拟器端口,其他模拟器可以改一下)连接到模拟器,代码里的设备码填写127.0.0.1:7555,经测试可正常使用。

2.adb devices找不到设备,或者手机安装不上那个ATX软件。
打开手机的开发者模式,并且授权电脑所有权限,或者授权文件传输。

3.pip安装依赖报错。
请关闭代理或者VPN,重新尝试,往往是代理造成的。

有任何问题请先群聊,私聊不回复,忙不过来。如果需要私聊帮助,请先发个咖啡红包。
微信群,因为人数超200,加微信邀请你进抢菜群,如果此工具对你有帮助,可赞赏支持:

qiangcai's People

Contributors

fierceray avatar sjj1024 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  avatar  avatar  avatar  avatar

qiangcai's Issues

叮咚买菜可以用,但是美团不会提交订单

D:\www\github_com\QiangCai\meituan.py:11: DeprecationWarning: Call to deprecated method service. (You should use d.uiautomator.start() instead) -- Deprecated since version 3.0.0.
if not d.service("uiautomator").running():
D:\www\github_com\QiangCai\meituan.py:17: DeprecationWarning: Call to deprecated function (or staticmethod) agent_alive. (This method will deprecated soon) -- Deprecated since version 3.0.0.
if not d.agent_alive:
本次花费时间: 2.187417507171631
总共花费时间: 0.036473286151885984 分钟,第 1 次
本次花费时间: 0.7598812580108643
总共花费时间: 0.04918815692265829 分钟,第 2 次
本次花费时间: 0.7427809238433838
总共花费时间: 0.06163778305053711 分钟,第 3 次
本次花费时间: 0.5844407081604004
总共花费时间: 0.07144516309102376 分钟,第 4 次
本次花费时间: 0.6644003391265869
总共花费时间: 0.08261044422785441 分钟,第 5 次
本次花费时间: 0.587352991104126
总共花费时间: 0.0924657940864563 分钟,第 6 次
本次花费时间: 0.5923583507537842
总共花费时间: 0.10238925218582154 分钟,第 7 次
本次花费时间: 0.7009298801422119
总共花费时间: 0.11412132978439331 分钟,第 8 次
本次花费时间: 0.6466548442840576
总共花费时间: 0.12493219375610351 分钟,第 9 次

每次点击时间好长,大概要接近2s

用的鸿蒙OS的实体机在跑测试,发现每次点击的时间都很长,最短也要1s多,最长要5s多。
image
问题是出在autoui吗,还是在电脑和手机之间的传输?

读取本地MP3文件失败了这个文件是不是损坏了

我把下面代码注释了才能用

def play_voice(content):
"""
播放声音提醒
"""
# system = platform.system()
# if system == "Windows":
# from playsound import playsound
# video_path = os.path.join(os.getcwd(), "sources/success.mp3")
# playsound(video_path)
# else:
# os.system(f'say "{content}"')

这是一种作弊行为!

作为一个程序员,深知掌握技术会有一些优势,但是对于生活物资来讲,不存在程序员就应该优先于其他人获得的情况,考虑一下别人的感受吧

Windows 10 初始化MCI时发生问题

D:\Program Files\QiangCai-main>python meituan.py

Error 277 for command:
    open "C:\Users\ADMINI~1\AppData\Local\Temp\PS7e_cwt44.mp3"
初始化 MCI 时发生问题。

Error 263 for command:
    close "C:\Users\ADMINI~1\AppData\Local\Temp\PS7e_cwt44.mp3"
指定的设备未打开,或不被 MCI 所识别。

Failed to close the file: "C:\Users\ADMINI1\AppData\Local\Temp\PS7e_cwt44.mp3"
Traceback (most recent call last):
File "D:\Program Files\QiangCai-main\meituan.py", line 94, in
run(device_name)
File "D:\Program Files\QiangCai-main\meituan.py", line 79, in run
play_voice("美好的一天,从抢菜开始")
File "D:\Program Files\QiangCai-main\meituan.py", line 32, in play_voice
playsound(video_path)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\playsound.py", line 44, in _playsoundWin
_playsoundWin(tempPath, block)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\playsound.py", line 72, in _playsoundWin
winCommand(u'open {}'.format(sound))
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\playsound.py", line 64, in winCommand
raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException:
Error 277 for command:
open "C:\Users\ADMINI
1\AppData\Local\Temp\PS7e_cwt44.mp3"
初始化 MCI 时发生问题。

关于无法安卓模拟器无法获取设备码

使用网易的mumu模拟器过程中发现不能正常获取设备码。通过执行adb connect 127.0.0.1:7555 (7555是模拟器端口,其他模拟器可以改一下)连接到模拟器,代码里的设备码填写127.0.0.1:7555,经测试可正常使用。

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.