diff --git a/fut/core.py b/fut/core.py index 44cb78c..41d01d6 100644 --- a/fut/core.py +++ b/fut/core.py @@ -324,7 +324,7 @@ def __login__(self, email, passwd, secret_answer, platform='pc', code=None, totp self.r.headers = headers_ios.copy() # i'm ios phone now ;-) else: self.r.headers = headers.copy() # i'm chrome browser now ;-) - if platform == 'pc': + if platform == 'pc': # TODO: get this from shards game_sku = 'FFA18PCC' elif platform == 'xbox': game_sku = 'FFA18XBO' @@ -334,7 +334,7 @@ def __login__(self, email, passwd, secret_answer, platform='pc', code=None, totp game_sku = 'FFA18PS3' # not tested elif platform == 'ps4': game_sku = 'FFA18PS4' - platform = 'ps3' # ps4 not available? + # platform = 'ps3' # ps4 not available in shards else: raise FutError(reason='Wrong platform. (Valid ones are pc/xbox/xbox360/ps3/ps4)') # if self.r.get(self.urls['main_site']+'/fifa/api/isUserLoggedIn', timeout=self.timeout).json()['isLoggedIn']: @@ -467,6 +467,7 @@ def __login__(self, email, passwd, secret_answer, platform='pc', code=None, totp self.fut_host = { 'pc': 'utas.external.s2.fut.ea.com:443', 'ps3': 'utas.external.s2.fut.ea.com:443', + 'ps4': 'utas.external.s2.fut.ea.com:443', 'xbox': 'utas.external.s3.fut.ea.com:443', # 'ios': 'utas.external.fut.ea.com:443', # 'and': 'utas.external.fut.ea.com:443' diff --git a/fut/pin.py b/fut/pin.py index d6d8822..0c2b6aa 100644 --- a/fut/pin.py +++ b/fut/pin.py @@ -21,15 +21,15 @@ class Pin(object): - def __init__(self, sku='FIFA18WEB', sid='', nucleus_id=0, persona_id='', dob=False, platform=False): - self.sku = sku + def __init__(self, sku=None, sid='', nucleus_id=0, persona_id='', dob=False, platform=False): self.sid = sid self.nucleus_id = nucleus_id self.persona_id = persona_id self.dob = dob self.platform = platform rc = requests.get('https://www.easports.com/fifa/ultimate-team/web-app/js/compiled_1.js').text - self.taxv = re.search('PinManager.TAXONOMY_VERSION=([0-9\.]+?)', rc).group(1) + self.sku = sku or re.search('enums.SKU.FUT="(.+?)"', rc).group(1) + self.taxv = re.search('PinManager.TAXONOMY_VERSION=([0-9\.]+)', rc).group(1) self.tidt = re.search('PinManager.TITLE_ID_TYPE="(.+?)"', rc).group(1) self.rel = re.search('rel:"(.+?)"', rc).group(1) self.gid = re.search('gid:([0-9]+?)', rc).group(1) @@ -105,7 +105,7 @@ def send(self, events): "is_sess": self.sid != '', "custom": self.custom, "events": events} - # print(data) # DEBUG + print(data) # DEBUG self.r.options(pin_url) rc = self.r.post(pin_url, data=json.dumps(data)).json() if rc['status'] != 'ok':