hsr-data icon indicating copy to clipboard operation
hsr-data copied to clipboard

O_VALUE (Version 1.2.0)

Open Vocaloid2048 opened this issue 1 year ago • 2 comments

Sorry for asking a dummy question, is that there have any possible way to get O_VALUE by user/myself? It seems O_VALUE has changed again (Since Version 1.2.0 updated) ... Thx for your help if possible Also sorry again if it's silly

  • Voc

Vocaloid2048 avatar Jul 24 '23 04:07 Vocaloid2048

API key : 37160d77fb2a075191bee3ec30c09687 U can get from starrailstation's -> choose one character -> main.ce34ec5f.js -> Search "Live"

Vocaloid2048 avatar Jul 25 '23 01:07 Vocaloid2048

Oh thanks for telling, sorry I have been busy irl, so I have not contributed or looked at the project at all, you can use this from automating.

import re
import json


def getAllOValues():
    URL = 'https://starrailstation.com/static/js/main.ce34ec5f.js'

    content_text = get(URL).text

    o_values = {}
    pattern = 'JSON\.parse\(.*?\)'

    results = re.findall(pattern, content_text)
    for result in results:
        if 'Live' in result:
            dict_ = json.loads(result[result.find("{"): result.find('}')+1])
            for key in dict_:
                sub_key = key.split('/')
                if sub_key[0].lower() not in o_values:
                    o_values[sub_key[0].lower()] = {}
                o_values[sub_key[0].lower()][sub_key[1].lower().replace('v', '', 1)] =  dict_[key]

    return o_values

print(getAllOValues())

reko-beep avatar Jul 27 '23 19:07 reko-beep