Giter VIP home page Giter VIP logo

honkai-starrail-toolkit's People

Contributors

littlenyima 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

honkai-starrail-toolkit's Issues

导出的抽卡记录只有前五条

抽卡记录是通过参数end_idsize来检索,而不是通过page,你的请求只改动page是没用的。你用postman测一下大概就明白我说的什么意思了。

首次同步数据报错

操作步骤:开启游戏查询记录,然后关闭游戏,点击工具箱同步数据

版本为0.5.4

image

关于autodet.py的一点修改意见

get_cache_path函数,米哈游偷偷改了cache文件的存储路径规则,改为按照版本号生成,建议改成

def get_cache_path(game_install_path):
    from functools import cmp_to_key
    def cmp(ver_a: str, ver_b: str):
        ver_a = ver_a.split('.')
        ver_b = ver_b.split('.')
        ver_a = [int(a) for a in ver_a]
        ver_b = [int(b) for b in ver_b]
        length = min(len(ver_a), len(ver_b))
        for i in range(length):
            if ver_a[i] != ver_b[i]:
                return ver_b[i] - ver_a[i]
        return len(ver_b) - len(ver_a)
    logger.info('Getting gacha query cache path')
    cache_path = os.path.join(
        game_install_path,
        'StarRail_Data', 'webCaches'
    )
    maybe_dirs = os.listdir(cache_path)
    # 排序,要版本号大的在前
    maybe_dirs = sorted(maybe_dirs, key=cmp_to_key(cmp))
    cache_path = os.path.join(
        cache_path,
        maybe_dirs[0],
        'Cache',
        'Cache_Data',
        'data_2'
    )

    if not os.path.exists(cache_path):
        error_msg = (
            f'Cache path {cache_path} is not existing. Please visit '
            'the gacha querying page before exporting gacha data.'
        )
        logger.error(error_msg)
    return cache_path

关于windows上无法打开被占用文件的问题,建议改成robocopy来复制,get_api_from_cache建议改成

def get_api_from_cache(cache_path):
    def get_api_form_cache_windows(cache_path):
        tmpdir_path='{}\\tmp'.format(os.path.abspath('.'))
        try:
            if os.path.exists(tmpdir_path) and os.path.isfile(tmpdir_path):
                tmpdir_path='{}{:0>4d}'.format(tmpdir_path, int(time.time()) % 10000)
                os.mkdir(tmpdir_path)
            if not os.path.exists(tmpdir_path):
                os.mkdir(tmpdir_path)
        except BaseException as E:
            logger.error('TODO20240413:{}'.format(E))
        else:
            cmd = 'robocopy "{}" "{}" data_2'.format(os.path.dirname(cache_path), tmpdir_path)
            res = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            res.wait(5)
            assert 0==res.returncode, res.stderr.read()
            cache_path='{}\\data_2'.format(tmpdir_path)
            logger.info('Creating tmp file ok')
            return cache_path

    logger.info('Getting api URL from cache')

    import os, time, subprocess
    if os.name.startswith('nt'):
        cache_path = get_api_form_cache_windows(cache_path)
    with open(cache_path, 'rb') as f_cache:
        cache = f_cache.read()
    parts = cache.split(b'1/0/')
    parts = [part.split(b'\x00')[0].decode(errors='ignore') for part in parts]
    parts = map(get_url_from_text, parts)
    parts = list(filter(bool, parts))
    if not parts:
        error_msg = (
            'API URL is not found in cache. Please visit the gacha querying '
            'page before exporting gacha data.'
        )
        logger.error(error_msg)
        return ''
    return get_latest_url(parts)

在python3.9,崩铁2.22,windows10上测试了以上修改是ok的,希望版本能够更新一下,谢谢,懒得提merge请求了

bug反馈?

93240914b6ea5ad8916a3cde91d09c6
第一次用git传issues 不知道图片大佬能不能看到..
我的操作步骤:1:开抽卡分析程序
2:开游戏后打开抽卡页面 打开抽卡记录信息
3:关游戏 同步数据 报错:Traceback (most recent call last):
File "starrail qui common thread.py", line 18in runFile "starrail\quilinterfaces gacha sync.py", line 79, in workValueError: 提取 APIURL失败,遇到的问题: Payload is None, response: null

api导入

怎么把api导入到抽卡分析工具里面?我在工具界面好像没有看到导入api的入口,教程里面也没有看到方法。可以在教程里面添加一下使用方法吗?

关于autodet.py的一点修改意见

get_cache_path函数,米哈游偷偷改了cache文件的存储路径规则,改为按照版本号生成,建议改成

def get_cache_path(game_install_path):
    from functools import cmp_to_key
    def cmp(ver_a: str, ver_b: str):
        ver_a = ver_a.split('.')
        ver_b = ver_b.split('.')
        ver_a = [int(a) for a in ver_a]
        ver_b = [int(b) for b in ver_b]
        length = min(len(ver_a), len(ver_b))
        for i in range(length):
            if ver_a[i] != ver_b[i]:
                return ver_b[i] - ver_a[i]
        return len(ver_b) - len(ver_a)
    logger.info('Getting gacha query cache path')
    cache_path = os.path.join(
        game_install_path,
        'StarRail_Data', 'webCaches'
    )
    maybe_dirs = os.listdir(cache_path)
    # 排序,要版本号大的在前
    maybe_dirs = sorted(maybe_dirs, key=cmp_to_key(cmp))
    cache_path = os.path.join(
        cache_path,
        maybe_dirs[0],
        'Cache',
        'Cache_Data',
        'data_2'
    )

    if not os.path.exists(cache_path):
        error_msg = (
            f'Cache path {cache_path} is not existing. Please visit '
            'the gacha querying page before exporting gacha data.'
        )
        logger.error(error_msg)
    return cache_path

关于windows上无法打开被占用文件的问题,建议改成robocopy来复制,get_api_from_cache建议改成

def get_api_from_cache(cache_path):
    def get_api_form_cache_windows(cache_path):
        tmpdir_path='{}\\tmp'.format(os.path.abspath('.'))
        try:
            if os.path.exists(tmpdir_path) and os.path.isfile(tmpdir_path):
                tmpdir_path='{}{:0>4d}'.format(tmpdir_path, int(time.time()) % 10000)
                os.mkdir(tmpdir_path)
            if not os.path.exists(tmpdir_path):
                os.mkdir(tmpdir_path)
        except BaseException as E:
            logger.error('TODO20240413:{}'.format(E))
        else:
            cmd = 'robocopy "{}" "{}" data_2'.format(os.path.dirname(cache_path), tmpdir_path)
            res = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            res.wait(5)
            assert 0==res.returncode, res.stderr.read()
            cache_path='{}\\data_2'.format(tmpdir_path)
            logger.info('Creating tmp file ok')
            return cache_path

    logger.info('Getting api URL from cache')

    import os, time, subprocess
    if os.name.startswith('nt'):
        cache_path = get_api_form_cache_windows(cache_path)
    with open(cache_path, 'rb') as f_cache:
        cache = f_cache.read()
    parts = cache.split(b'1/0/')
    parts = [part.split(b'\x00')[0].decode(errors='ignore') for part in parts]
    parts = map(get_url_from_text, parts)
    parts = list(filter(bool, parts))
    if not parts:
        error_msg = (
            'API URL is not found in cache. Please visit the gacha querying '
            'page before exporting gacha data.'
        )
        logger.error(error_msg)
        return ''
    return get_latest_url(parts)

在python3.9,崩铁2.22,windows10上测试了以上修改是ok的,希望版本能够更新一下,谢谢,懒得提merge请求了

BUG反馈

image
疑似url又挂了
可恶 托帕歪姬子了

下载windows gui版本 运行报错 "提取 API URL 失败,请关闭游戏或重新查询抽卡信息后重试。"

已经开启过游戏 刷新过 cache2 文件。
下载源码运行

2023-05-12 13:52:08,310 gacha\service.py Line 38 - [INFO] Length of payload.data.list: 0
2023-05-12 13:52:31,049 gacha\service.py Line 77 - [CRITICAL] Error while checking response from api URL, exitting
  File "D:\Person\project\per\honkai-starrail-toolkit-develop\honkai-starrail-toolkit-develop\starrail\gacha\service.py", line 78, in export_gacha_from_api
    raise ValueError('Invalid or expired api, please check your input')
ValueError: Invalid or expired api, please check your input

定位

    def syncGachaData(self):
        self.logAndUpdateState(babelfish.ui_extracting_api_url())
        api_url = service.detect_api_url()
        response, code = service.fetch_json(api_url)
        valid = service.check_response(response, code)

网页访问api_url返回

{
    "retcode": 0,
    "message": "OK",
    "data": {
        "page": "1",
        "size": "5",
        "list": [],
        "region": "prod_gf_cn",
        "region_time_zone": 8
    }
}

在 ‘ service.check_response’ 抛异常了

if not payload['data']['list']:
        logger.info(
            f'Length of payload.data.list: '
            f'{len(payload["data"]["list"])}',
        )
        return False

源码 版本 20230512 12:00 直接下载的develop.zip
gui程序版本 StarRailToolkit-v0.5.4_windows-64bit

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.