Open m3fist0 opened 4 years ago
i tried all the ways in instruction and googled a lot. there is no access token in any of requests. hepers.py also does nothing. please tell me how to get access token right now
If this question is still relevant, you could obtain a token by a little bit rewriting the pynder. They do not maintain the package, I've copied their package and modified it. You can retrieve facebook token via this function
USER_AGENT = 'Tinder/11.18.0 (iPhone; iOS 12.4.7; Scale/2.00)'
FB_AUTH_LINK = 'https://www.facebook.com/v7.0/dialog/oauth?redirect_uri=fb464891386855067%3A%2F%2Fauthorize%2F&display=touch&state=%7B%22challenge%22%3A%22IUUkEUqIGud332lfu%252BMJhxL4Wlc%253D%22%2C%220_auth_logger_id%22%3A%2230F06532-A1B9-4B10-BB28-B29956C71AB1%22%2C%22com.facebook.sdk_client_state%22%3Atrue%2C%223_method%22%3A%22sfvc_auth%22%7D&scope=user_birthday%2Cuser_photos%2Cuser_education_history%2Cemail%2Cuser_relationship_details%2Cuser_friends%2Cuser_work_history%2Cuser_likes&response_type=token%2Csigned_request&default_audience=friends&return_scopes=true&auth_type=rerequest&client_id=464891386855067&ret=login&sdk=ios&logger_id=30F06532-A1B9-4B10-BB28-B29956C71AB1&ext=1470840777&hash=AeZqkIcf-NEW6vBd'
def get_facebook_access_token(facebook_email, facebook_password):
browser = robobrowser.RoboBrowser(user_agent=USER_AGENT, parser="lxml")
browser.open(FB_AUTH_LINK)
form = browser.get_form()
form["pass"] = facebook_password
form["email"] = facebook_email
browser.submit_form(form)
form = browser.get_form()
try:
browser.submit_form(form, submit=form.submit_fields['__CONFIRM__'])
access_token = re.search(
r"access_token=([\w\d]+)", browser.response.content.decode()).groups()[0]
return access_token
except requests.exceptions.InvalidSchema as browserAddress:
access_token = re.search(
r"access_token=([\w\d]+)", str(browserAddress)).groups()[0]
return access_token
except Exception as ex:
print("access token could not be retrieved. Check your username and password.")
print("Official error: %s" % ex)
return {"error": "access token could not be retrieved. Check your username and password."}
And, after obtain a XAuthToken of the Tinder
def _get_xauth_token(self, fb_auth_token):
"""In most of cases use this method to retrieve a XAuthToken.
:param fb_auth_token: the authentication token obtained from facebook using your fb email and fb password.
:return: either a token nor None if token is missing.
"""
response = self._session.request(
'POST',
'https://api.gotinder.com/v2/auth/login/facebook',
headers={'app_version': '11', 'platform': 'ios', 'content-type': 'application/json'},
data=json.dumps({'token': fb_auth_token}),
timeout=1,
)
try:
return response.json()['data']['api_token']
except:
return None
i tried all the ways in instruction and googled a lot. there is no access token in any of requests. hepers.py also does nothing. please tell me how to get access token right now
If this question is still relevant, you could obtain a token by a little bit rewriting the pynder. They do not maintain the package, I've copied their package and modified it. You can retrieve facebook token via this function
USER_AGENT = 'Tinder/11.18.0 (iPhone; iOS 12.4.7; Scale/2.00)' FB_AUTH_LINK = 'https://www.facebook.com/v7.0/dialog/oauth?redirect_uri=fb464891386855067%3A%2F%2Fauthorize%2F&display=touch&state=%7B%22challenge%22%3A%22IUUkEUqIGud332lfu%252BMJhxL4Wlc%253D%22%2C%220_auth_logger_id%22%3A%2230F06532-A1B9-4B10-BB28-B29956C71AB1%22%2C%22com.facebook.sdk_client_state%22%3Atrue%2C%223_method%22%3A%22sfvc_auth%22%7D&scope=user_birthday%2Cuser_photos%2Cuser_education_history%2Cemail%2Cuser_relationship_details%2Cuser_friends%2Cuser_work_history%2Cuser_likes&response_type=token%2Csigned_request&default_audience=friends&return_scopes=true&auth_type=rerequest&client_id=464891386855067&ret=login&sdk=ios&logger_id=30F06532-A1B9-4B10-BB28-B29956C71AB1&ext=1470840777&hash=AeZqkIcf-NEW6vBd' def get_facebook_access_token(facebook_email, facebook_password): browser = robobrowser.RoboBrowser(user_agent=USER_AGENT, parser="lxml") browser.open(FB_AUTH_LINK) form = browser.get_form() form["pass"] = facebook_password form["email"] = facebook_email browser.submit_form(form) form = browser.get_form() try: browser.submit_form(form, submit=form.submit_fields['__CONFIRM__']) access_token = re.search( r"access_token=([\w\d]+)", browser.response.content.decode()).groups()[0] return access_token except requests.exceptions.InvalidSchema as browserAddress: access_token = re.search( r"access_token=([\w\d]+)", str(browserAddress)).groups()[0] return access_token except Exception as ex: print("access token could not be retrieved. Check your username and password.") print("Official error: %s" % ex) return {"error": "access token could not be retrieved. Check your username and password."}
And, after obtain a XAuthToken of the Tinder
def _get_xauth_token(self, fb_auth_token): """In most of cases use this method to retrieve a XAuthToken. :param fb_auth_token: the authentication token obtained from facebook using your fb email and fb password. :return: either a token nor None if token is missing. """ response = self._session.request( 'POST', 'https://api.gotinder.com/v2/auth/login/facebook', headers={'app_version': '11', 'platform': 'ios', 'content-type': 'application/json'}, data=json.dumps({'token': fb_auth_token}), timeout=1, ) try: return response.json()['data']['api_token'] except: return None
any working variants of this repo?
i am getting this when running bot/img_scrape too
(facerating) PS C:\Users\kilua\envs\facerating\tinderautomation> python img_scrape.py
Traceback (most recent call last):
File "C:\Users\kilua\envs\facerating\tinderautomation\img_scrape.py", line 4, in
i tried all the ways in instruction and googled a lot. there is no access token in any of requests. hepers.py also does nothing. please tell me how to get access token right now