This repository has been archived by the owner on Mar 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 134
/
fgourl.py
85 lines (63 loc) · 2.2 KB
/
fgourl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import json
import binascii
import requests
import version
import main
import CatAndMouseGame
requests.urllib3.disable_warnings()
session = requests.Session()
session.verify = False
# ===== Game's parameters =====
app_ver_ = ''
data_ver_ = 0
date_ver_ = 0
ver_code_ = ''
asset_bundle_folder_ = ''
data_server_folder_crc_ = 0
server_addr_ = 'https://game.fate-go.jp'
github_token_ = ''
github_name_ = ''
user_agent_ = 'Dalvik/2.1.0 (Linux; U; Android 11; Pixel 5 Build/RD1A.201105.003.A1)'
# ==== User Info ====
def set_latest_assets():
global app_ver_, data_ver_, date_ver_, asset_bundle_folder_, data_server_folder_crc_, ver_code_, server_addr_
region = main.fate_region
# Set Game Server Depends of region
if region == "NA":
server_addr_ = "https://game.fate-go.us"
# Get Latest Version of the data!
version_str = version.get_version(region)
response = requests.get(
server_addr_ + '/gamedata/top?appVer=' + version_str).text
response_data = json.loads(response)["response"][0]["success"]
# Set AppVer, DataVer, DateVer
app_ver_ = version_str
data_ver_ = response_data['dataVer']
date_ver_ = response_data['dateVer']
ver_code_ = main.get_latest_verCode()
# Use Asset Bundle Extractor to get Folder Name
assetbundle = CatAndMouseGame.getAssetBundle(response_data['assetbundle'])
get_folder_data(assetbundle)
def get_folder_data(assetbundle):
global asset_bundle_folder_, data_server_folder_crc_
asset_bundle_folder_ = assetbundle['folderName']
data_server_folder_crc_ = binascii.crc32(
assetbundle['folderName'].encode('utf8'))
# ===== End =====
httpheader = {
'Accept-Encoding': 'gzip, identity',
'User-Agent': user_agent_,
'Content-Type': 'application/x-www-form-urlencoded',
'Connection': 'Keep-Alive, TE',
'TE': 'identity',
}
def NewSession():
return requests.Session()
def PostReq(s, url, data):
res = s.post(url, data=data, headers=httpheader, verify=False).json()
res_code = res['response'][0]['resCode']
if res_code != '00':
detail = res['response'][0]['fail']['detail']
message = f'[ErrorCode: {res_code}]\n{detail}'
raise Exception(message)
return res