Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python3
- import requests, json, re, time
- from argparse import ArgumentParser
- from random import randint
- # create parser for x-auth argument
- parser = ArgumentParser(
- prog = 'Match Maker',
- description = 'Matches you with all the people that liked you on Tinder by liking them back.',
- epilog = 'If you liked this script and got money to spare, consider donating to charity :).')
- parser.add_argument('--chatty', action='store_true')
- parser.add_argument('x_auth_token', type=str, metavar='x-auth-token', help='You can learn how to find your x-auth-token here: [insert link].' +
- '\n\n IMPORTANT: NEVER share your token, it can compromise your account!\nNEVER execute random scripts or programs blindly.' +
- 'Read through the source code or ask a friend who understands source code to veriy this script is not malicous!')
- args = parser.parse_args()
- # define URLs and create session
- TINDER_TEASER_URL = "https://api.gotinder.com/v2/fast-match/teaser?locale=en"
- TINDER_LIKE_URL = "https://api.gotinder.com/like/USER_ID?locale=en"
- PARAM_RECENTLY_ACTIVE = "&type=recently-active"
- session = requests.Session()
- # probably don't need all that... but whatever
- headers = {
- "X-Auth-Token": args.x_auth_token,
- "platform": "android",
- "Accept": "application/json",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "en,en-US",
- "app-session-time-elapsed": "354605",
- "app-version": "1035502",
- "Cache-Control": "no-cache",
- "Connection": "keep-alive",
- "Content-Type": "application/json",
- "Host": "api.gotinder.com",
- "Origin": "https://tinder.com",
- "Pragma": "no-cache",
- "Referer": "https://tinder.com/",
- "Sec-Fetch-Dest": "empty",
- "Sec-Fetch-Mode": "no-cors",
- "Sec-Fetch-Site": "cross-site",
- "TE": "trailers",
- "tinder-version": "3.55.2",
- "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/101.0",
- "user-session-time-elapsed": "35353",
- "x-supported-image-formats": "webp,jpeg"
- }
- # retrieve user id of most teaser image
- def get_teaser_id(recent=False):
- re_extract = "https://images-ssl.gotinder.com/(.*)/\d{2}x\d{2}"
- key, url = "", ""
- try:
- if recent:
- content = json.loads(requests.get(TINDER_TEASER_URL+PARAM_RECENTLY_ACTIVE, headers=headers).content)
- url = content["data"]["recently_active"]["image_url"]
- else:
- content = json.loads(requests.get(TINDER_TEASER_URL, headers=headers).content)
- url = content["data"]["teaser_url"]
- if args.chatty:
- if "X-Padding" in content: content["X-Padding"] = "redacted"
- print(f"get_teaser_id(): url={url}")
- return re.findall(re_extract, url)[0]
- except Exception as e:
- print("Couldn't access your likes. This probably means your x-auth-token is incorrect or outdated.", e)
- return None
- # send like to given user_id
- def send_like(user_id):
- response = json.loads(requests.post(TINDER_LIKE_URL.replace("USER_ID", user_id), headers=headers).content)
- if args.chatty:
- if "X-Padding" in response: response["X-Padding"] = "redacted"
- print(f"send_like({user_id}): {response}")
- try:
- return response["status"] == 200 and response["match"] != False
- except Exception as e:
- print("Couldn't send a 'like' to Tinder. This probably means your x-auth-token is incorrect or outdated.", e)
- return False
- # generate body for post request containing a random "s_number"
- def generate_body():
- s = ''
- for i in range(16):
- s = s + str(randint(0,9))
- return {"s_number": int(s)}
- # go as long as there are likes or the script fails otherwise
- adored = True
- match_count = 0
- print("Welcome to Match Maker.\nIf you need help, type python ./match-maker.py --help\nor visit the corresponding subreddit: https://www.reddit.com/r/hacking/comments/zm373p/bypassing_tinders_paywall_like_people_back_that/")
- print(f"\rMatches so far: {match_count}", end="")
- while adored:
- # make sure retrieving user id and sending like were successful
- success = send_like(get_teaser_id())
- if not success:
- success = send_like(get_teaser_id(recent=True))
- if success:
- # increase number of matches, print status, wait a bit (just to be safe)
- match_count += 1
- print(f"\rMatches so far: {match_count}", end="")
- time.sleep(1)
- else:
- # end the loop
- adored = False
- print("\nIf you liked this script and got money to spare, consider donating to charity :)")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement