The idea of repository based on https://github.com/chaserhkj/PyMajSoul/
Python wrappers for Majsoul allow you to interact with their servers from Python scripts.
- Install python packages from
requirements.txt
python example.py -u username -p password
This example is working only with Python3.7+.
Also, you need to have an account from CN server to run this example, because only accounts from CN server has the ability to login with login and password.
If you want to login to EN or JP servers you need to write your code to authenticate via email code or social network. Protobuf wrapper from this repository contains all needed API objects for that.
- Install python packages from
requerements.txt
- Install protobuf compiler
sudo apt install protobuf-compiler
It was tested on Ubuntu.
- Download the new
liqi.json
file from MS (find it in the network tab of your browser) and put it toms/liqi.json
python generate_proto_file.py
protoc --python_out=. protocol.proto
chmod +x ms-plugin.pychmod +x ms-plugin.py
sudo cp ms-plugin.py /usr/bin/ms-plugin.py
protoc --custom_out=. --plugin=protoc-gen-custom=ms-plugin.py ./protocol.proto
- Prepare new
liqi_admin.json
file from MS tournament manager panel python ms_tournament/generate_proto_file.py
protoc --python_out=. protocol_admin.proto
chmod +x ms-admin-plugin.py
sudo cp ms-admin-plugin.py /usr/bin/ms-admin-plugin.py
protoc --custom_out=. --plugin=protoc-gen-custom=ms-admin-plugin.py ./protocol_admin.proto
pip install twine
python setup.py sdist
twine upload dist/*
とりあえず中国版で sample.py を動かすことはできた
poetry shell
poetry install
python example.py -u **mailAddress** -p **password**
____
wget https://game.maj-soul.com/1/v0.10.297.w/res/proto/liqi.json
2023-11-19 07:37:19 INFO: Version: {'version': '0.10.301.w', 'force_version': '0.10.0.w', 'code': 'v0.10.301.w/code.js'}
2023-11-19 07:37:19 INFO: Config: {'ip': [{'name': 'player', 'region_urls': [{'url': 'https://mjjpgs.mahjongsoul.com:8443/api/v0/recommend_list', 'ob_url': 'wss://mjjpgs.mahjongsoul.com:5330/ob'}]}], 'goods_sheleve_id': 'shelves_001', 'yo_service_url': ['https://passport.mahjongsoul.com'], 'yo_sdk_js': 'yo_acc.prod_ja.js', 'jp_shop_js': 'https://static.mul-pay.jp/ext/js/token.js', 'jp_shop_id': '9200000213740'}
'Traceback (most recent call last):\n File "/Users/xxx/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_resolver.py", line 189, in _get_py_dictionary\n attr = getattr(var, name)\n ^^^^^^^^^^^^^^^^^^\nAttributeError\n'
モチベとしては、3 たまなんは時間によって土間レベルが全然違うので 3 たま南を定期的に観測して対局者の段位などを取得する(雑打ちする人を観測する)