Giter VIP home page Giter VIP logo

mys_goods_tool's Introduction

Mys_Goods_Tool 预览 Mys_Goods_Tool 预览2

米游社商品兑换工具

CodeFactor 最新发行版 最后提交 代码行数 构建结果 Python版本兼容性测试

更新说明

2023.10.11

由于无法解决兑换失败,兑换请求结果状态码 1028 的问题,以及个人安排等原因,本工具将停止更新

v2.1.0

  • 在兑换开始后的一段时间内不断尝试兑换,直到成功
  • 兑换开始后将不会延迟兑换,用户数据文件中 preference.exchange_latency 将作为同一线程下每个兑换请求之间的时间间隔
  • 兑换请求日志内容增加了发送请求时的时间戳

功能和特性

  • 使用 Textual 终端图形界面库,支持 Windows / Linux / macOS 甚至可能是移动端SSH客户端
  • 短信验证码登录(只需接收一次验证码)
  • 内置人机验证页面,无需前往官网验证
  • 多账号支持
  • 支持米游社所有分区的商品兑换

预览图

短信验证登录 短信验证登录页面 人机验证页面
管理兑换计划 选择目标商品页面 确认添加计划页面 管理计划页面
进入兑换模式 兑换模式页面

使用说明

参考 🛠️ 下载安装

常见问题

参考 ❓ 常见问题

代码结构

参考 📃 代码结构

其他

mys_goods_tool's People

Contributors

aellyt avatar leo01234 avatar ljzd-pro avatar night-stars-1 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

mys_goods_tool's Issues

获取地址信息失败

系统: Win Server2019
版本: 1.4.2
米游社中已确认添加收货地址(因为我之前手抢到过实物所以肯定有,又确认了一下)
已补全cookie

获取不到Address_ID

查询结果:

请输入你要选择的地址ID(Address_ID):
-- 注意:将对 config.ini 配置文件进行写入,文件中的注释和排版将被重置
-- 按回车键跳过并返回功能选择界面

大佬能帮忙看看吗,win版本,address id查询结果是空的,log里也是空的,通过输入两次验证码登录配置的cookie

每秒轮询

Tmux挂在后台,早上起来发现发热比较严重,不知道是不是循环太频繁的缘故
可以考虑在兑换开始前 sleep 阻塞,然后提前 1-2 分钟唤醒?

若没有Stocken同样无法抢购非游戏内道具

main.py中的第181行处while循环在没有定义正确的stocken时,发送get请求无法得到正确的结果也就没办法跳出循环。如果未定义stocken也可以兑换非游戏内物品的话这里是不是要作出修改呀

181:        while True:
            try:
                print(to_log("INFO", "正在获取用户ActionTicket"))
                getActionTicket_headers = self.headers.copy()
                getActionTicket_headers[
                    "User-Agent"] = USER_AGENT_GET_ACTION_TICKET
                getActionTicket_headers.setdefault("DS", Good.get_DS())
                getActionTicket_req = self.req.get(
                    getActionTicket,
                    headers=getActionTicket_headers,
                    timeout=TIME_OUT)
                actionTicket = json.loads(
                    getActionTicket_req.text)["data"]["ticket"]
                break
            except:
                print(to_log("ERROR", traceback.format_exc()))
                print(to_log("ERROR", "获取用户ActionTicket失败,正在重试"))
                continue

缺少业务编号

2022-03-30 18:59:36 INFO 网络连接正常,延时 53.7 ms

2022-03-30 18:59:46 INFO 网络连接正常,延时 46.91 ms

2022-03-30 18:59:56 INFO 网络连接正常,延时 37.01 ms

2022-03-30 19:00:00 INFO 兑换商品
2022032912696
返回结果:
{"data":null,"message":"缺少业务编号","retcode":-2005}

2022-03-30 19:00:00 INFO 兑换商品
2022032912509
返回结果:
{"data":null,"message":"缺少业务编号","retcode":-2005}

2022-03-30 19:00:00 INFO 兑换商品
2022032912734
返回结果:
{"data":null,"message":"缺少业务编号","retcode":-2005}

Snipaste_2022-03-30_19-07-12

Adress_ID查询结果为空

Adress_ID查询结果为空怎么办?如果config文件不写Adress_ID影响游戏内虚拟物品的兑换吗?初次使用不太会用,希望大佬解答一下,谢谢!

如何支持循环兑换

我发现他兑换三次后就会终止,请问如何能做到一直兑换,这样我就可以提前打开不用掐点打开
image

timeUp在isCheck为False时未定义

timeUpif isCheck内定义:

Mys_Goods_Tool/main.py

Lines 545 to 551 in c4d1386

if isCheck:
try:
checkTime = int(checkTime)
stopCheck = int(stopCheck)
timeUp = time.mktime(time.strptime(
timeUp_Str, "%Y-%m-%d %H:%M:%S"))

因此,在isCheckFalse时,
if NtpTime.time() >= CheckNetwork.timeUp: # 执行兑换操作

使用timeUp时会出现错误。

可能的解决方案

可以考虑在该行之后定义timeUp

timeUp_Str = conf.get("Config", "Time") # 获取配置文件中的兑换开始时间

未配置 stoken

在明明已经配置好stoken的情况下报了错
stoken使用httpcanary抓的
image

主程序运行完成后窗口未保持

1.3与1.4版本,在配置完cookies等信息之后,尝试设置一个虚假时间(因为看到作者大大说可以配置完后可以设置时间来测试是否返回未到兑换时间),运行主程序,到指定时间完成任务后就自动关闭窗口,来不及看到其返回信息

关于cookie的mid&兑换结果502

用网页端短信验证码登陆获得了cookie,但是没看到参数mid,还有stoken在示例里没有,是需要手动添加吗?

获取用户ActionTicket失败

2022-06-28 20:09:16 INFO 正在获取用户ActionTicket
2022-06-28 20:09:16 ERROR 获取用户ActionTicket失败,正在重试(3)
2022-06-28 20:09:16 ERROR Traceback (most recent call last):
File "main.py", line 329, in init
TypeError: 'NoneType' object is not subscriptable

cookie获取

用户cookie是通过抓米游社app的包获取 还是在pc上访问bbs.mihoyo.com/ys获取。

读取配置文件失败

2022-06-28 16:53:52 INFO 正在校对互联网时间
2022-06-28 16:53:41 ERROR 读取配置文件失败
2022-06-28 16:53:41 ERROR Traceback (most recent call last):
File "main.py", line 131, in
File "configparser.py", line 698, in read
File "configparser.py", line 1086, in _read
configparser.MissingSectionHeaderError: File contains no section headers.
file: 'E:\miyousheduihuan\config.ini', line: 1
'\ufeff[Config]\n'

大佬配置好了发现用不了

image
image
image
ck和各种参数都抓了照着格式填的,之前以为格式错了特地重新试了下发现还是不行😥

想用工具自动获取,但是黄鸟导出的json分析不了?看了下文件里里面是有所有数据的😂
image

tool.py 工具自动获取cookie处理har文件编码有误

我从stream抓包下来后用tool.py自动处理获取cookie,遇到了unicodedecodeerror,实测用utf-8模式打开har文件即可
即第345行应该为
file_data = json.load(open(file_path, "r", encoding="utf-8"))
不然会认为文件损坏

此外除了mid数据 其余大多数数据都可以在网页版抓包获得
bbs.mihoyo.com
user.mihoyo.com
这两个网页中能抓到除mid和stoken外所有字段

stoken数据段可以访问
https://api-takumi.mihoyo.com/auth/api/getMultiTokenByLoginTicket?login_ticket={}&token_types=3&uid={}获得
其中uid字段为网页端可获取的stuid数据段

另外 本人抓取了大量米游社内容 但是就是没有找到mid... 不知道是不是因为系统更改了之类的.. 望解答

网页端获取的cookie无法使用

首先感谢佬,我已经用手机抓包操作成功过。
但我想图个方便,用网页端获取,方法是从别的地方学的,如下
2ade0cde9d4adc2d
(使用插件cookie editor更方便)
能够获取到所有需要的字符串
填好后能获取商品信息和地址
但运行main.exe会显示

2022-06-19 10:39:56 ERROR 获取用户ActionTicket失败,正在重试
2022-06-19 10:39:56 INFO 正在获取用户ActionTicket

比较好奇这是为什么

再一次感谢佬

获取stoken

怎么手动获取stoken 或者怎么使用tool.exe,如果使用firefox登录米游社网页,然后在开发者模式的网络中右键“所有内容另存为HAR”后得到的HAR文件,tool.exe会显示 文件错误或损坏,要求 .har 文件(回车以返回)

{"data":null,"message":"缺少业务编号","retcode":-2005}

2022-10-12 19:08:41 INFO 兑换商品:2022092712366 返回结果:
{"data":null,"message":"缺少业务编号","retcode":-2005}

想试着兑换摩拉,一直返回缺少业务编号的错误,cookie适用tool抓的,大佬能帮忙看下吗

ERROR 获取用户ActionTicket失败,正在重试

2022-05-07 19:39:39 INFO 正在获取用户ActionTicket
2022-05-07 19:39:39 ERROR Traceback (most recent call last):
File "main.py", line 192, in init
actionTicket = json.loads(
TypeError: 'NoneType' object is not subscriptable

2022-05-07 19:44:22 ERROR 获取用户ActionTicket失败,正在重试
2022-05-07 19:44:22 INFO 正在获取用户ActionTicket
2022-05-07 19:44:22 ERROR Traceback (most recent call last):
File "main.py", line 192, in init
TypeError: 'NoneType' object is not subscriptable
换实物时提示这个,大佬救一下😭

缺少业务编号

image
想先试试水,就拿那个米游社7天头像框试了一下,结果不管是我自己抓参数,还是使用tool.py来抓,都返回的这个,这咋办呢

关于安卓7.0以上版本抓包困难问题

看了很多关于抓包的文章Android 7.0以上的不信任用户安装的证书,通过PC FD安装证书抓不到,手机大多数还有root锁,所以用了一个虚拟环境xposed的应用和JustTrustMe抓到了Https包找不到stoken

cookie 中的 stoken 重复

这里是不是应该 cookie.find("stoken") == -1 ,找不到的时候才往 cookie 拼 stoken,现在拼出来的 cookie 会有两个 stoken

Mys_Goods_Tool/main.py

Lines 180 to 181 in 56b5ef2

if stoken != "..." and stoken != "" and cookie.find("stoken") != -1:
cookie += ("stoken=" + stoken + ";")

填写了stoken还是提示未配置

2022-07-13 15:02:20 ERROR 商品:2022071212819 为游戏内物品,由于未配置 stoken,放弃兑换该商品
请问stoken怎么获取
更新版本之后错误变成获取用户ActionTicket失败

cookie怎么抓?

_ga_KJ6J9V9VZQ=...; _ga=...; _MHYUUID=...; _ga_6ZB57V7XXT=...; mi18nLang=...; _ga_831VBKXN1V=...; _ga_CXN1FSHKS4=...; _ga_9TTX3TE5YL=... 就这些。。。没抓到过一次。。其他的都抓到了,就这些没有,大佬有法子吗

检测的时间由本地改为互联网时间

米游社的60原石我之前手动抢了6次,一次都没抢到,今天终于抢到了,哈哈哈
非常感谢作者
[提一点小意见,检查时间可以改为检查网络时间,不用本地时间,因为可能有些设备的本地时间不准确,我这次就是在抢之前同步了一下时间]

大佬帮忙看一下,获取用户ActionTicket失败,正在重试

2022-05-09 08:58:35 INFO 正在检查商品:... 的详细信息
2022-05-09 08:58:46 INFO 正在获取用户ActionTicket
2022-05-09 08:58:46 ERROR Traceback (most recent call last):
File "main.py", line 192, in init
TypeError: 'NoneType' object is not subscriptable

2022-05-09 08:58:46 ERROR 获取用户ActionTicket失败,正在重试
2022-05-09 08:58:46 INFO 正在获取用户ActionTicket
2022-05-09 08:58:46 ERROR Traceback (most recent call last):
File "main.py", line 192, in init
TypeError: 'NoneType' object is not subscriptable

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.