mirror of
https://github.com/frozenpandaman/s3s.git
synced 2026-04-25 08:08:00 -05:00
code cleanup (#66)
Co-authored-by: eli <frozenpandaman@users.noreply.github.com>
This commit is contained in:
parent
9999e5586f
commit
2d59ff653c
8
iksm.py
8
iksm.py
|
|
@ -89,22 +89,22 @@ def get_web_view_ver(bhead=[], gtoken=""):
|
|||
'X-Requested-With': 'com.nintendo.znca',
|
||||
'Sec-Fetch-Site': 'same-origin',
|
||||
'Sec-Fetch-Mode': 'no-cors',
|
||||
'Sec-Fetch-Dest': 'script'
|
||||
'Sec-Fetch-Dest': 'script',
|
||||
'Referer': SPLATNET3_URL # sending w/o lang, na_country, na_lang params
|
||||
}
|
||||
if bhead:
|
||||
app_head["User-Agent"] = bhead.get("User-Agent")
|
||||
app_head["Referer"] = bhead.get("Referer")
|
||||
app_head["Accept-Encoding"] = bhead.get("Accept-Encoding")
|
||||
app_head["Accept-Language"] = bhead.get("Accept-Language")
|
||||
|
||||
main_js_body = requests.get(main_js_url, headers=app_head, cookies=app_cookies)
|
||||
if main_js_body.status_code != 200:
|
||||
return iksm.WEB_VIEW_VER_FALLBACK
|
||||
return WEB_VIEW_VER_FALLBACK
|
||||
|
||||
pattern = r"\b(?P<revision>[0-9a-f]{40})\b.*revision_info_not_set\"\),.*?=\"(?P<version>\d+\.\d+\.\d+)"
|
||||
match = re.search(pattern, main_js_body.text)
|
||||
if match is None:
|
||||
return iksm.WEB_VIEW_VER_FALLBACK
|
||||
return WEB_VIEW_VER_FALLBACK
|
||||
|
||||
version, revision = match.group("version"), match.group("revision")
|
||||
ver_string = f"{version}-{revision[:8]}"
|
||||
|
|
|
|||
5
s3s.py
5
s3s.py
|
|
@ -88,7 +88,7 @@ def headbutt():
|
|||
'Authorization': f'Bearer {BULLETTOKEN}', # update every time it's called with current global var
|
||||
'Accept-Language': USER_LANG,
|
||||
'User-Agent': APP_USER_AGENT,
|
||||
'X-Web-View-Ver': iksm.WEB_VIEW_VERSION,
|
||||
'X-Web-View-Ver': iksm.get_web_view_ver(),
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': '*/*',
|
||||
'Origin': iksm.SPLATNET3_URL,
|
||||
|
|
@ -105,8 +105,7 @@ def prefetch_checks(printout=False):
|
|||
if printout:
|
||||
print("Validating your tokens...", end='\r')
|
||||
|
||||
global WEB_VIEW_VERSION
|
||||
WEB_VIEW_VERSION = iksm.get_web_view_ver()
|
||||
iksm.get_web_view_ver() # setup
|
||||
|
||||
if SESSION_TOKEN == "" or GTOKEN == "" or BULLETTOKEN == "":
|
||||
gen_new_tokens("blank")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user