Advertisement
Guest User

match-maker

a guest
Dec 14th, 2022
3,780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.41 KB | Cybersecurity | 0 0
  1. #! /usr/bin/env python3
  2. import requests, json, re, time
  3. from argparse import ArgumentParser
  4. from random import randint
  5.  
  6. # create parser for x-auth argument
  7. parser = ArgumentParser(
  8.         prog = 'Match Maker',
  9.         description = 'Matches you with all the people that liked you on Tinder by liking them back.',
  10.         epilog = 'If you liked this script and got money to spare, consider donating to charity :).')
  11. parser.add_argument('--chatty', action='store_true')
  12. 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].' +
  13.                 '\n\n IMPORTANT: NEVER share your token, it can compromise your account!\nNEVER execute random scripts or programs blindly.' +
  14.                 'Read through the source code or ask a friend who understands source code to veriy this script is not malicous!')
  15. args = parser.parse_args()
  16.  
  17. # define URLs and create session
  18. TINDER_TEASER_URL = "https://api.gotinder.com/v2/fast-match/teaser?locale=en"
  19. TINDER_LIKE_URL = "https://api.gotinder.com/like/USER_ID?locale=en"
  20. PARAM_RECENTLY_ACTIVE = "&type=recently-active"
  21.  
  22. session = requests.Session()
  23.  
  24. # probably don't need all that... but whatever
  25. headers = {
  26.     "X-Auth-Token": args.x_auth_token,
  27.     "platform": "android",
  28.     "Accept": "application/json",
  29.         "Accept-Encoding": "gzip, deflate, br",
  30.         "Accept-Language": "en,en-US",
  31.         "app-session-time-elapsed": "354605",
  32.         "app-version": "1035502",
  33.         "Cache-Control": "no-cache",
  34.         "Connection": "keep-alive",
  35.         "Content-Type": "application/json",
  36.         "Host": "api.gotinder.com",
  37.         "Origin": "https://tinder.com",
  38.         "Pragma": "no-cache",
  39.         "Referer": "https://tinder.com/",
  40.         "Sec-Fetch-Dest": "empty",
  41.         "Sec-Fetch-Mode": "no-cors",
  42.         "Sec-Fetch-Site": "cross-site",
  43.         "TE": "trailers",
  44.         "tinder-version": "3.55.2",
  45.         "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/101.0",
  46.         "user-session-time-elapsed": "35353",
  47.         "x-supported-image-formats": "webp,jpeg"
  48. }
  49.  
  50.  
  51. # retrieve user id of most teaser image
  52. def get_teaser_id(recent=False):
  53.     re_extract = "https://images-ssl.gotinder.com/(.*)/\d{2}x\d{2}"
  54.     key, url = "", ""
  55.     try:
  56.         if recent:
  57.             content = json.loads(requests.get(TINDER_TEASER_URL+PARAM_RECENTLY_ACTIVE, headers=headers).content)
  58.             url =  content["data"]["recently_active"]["image_url"]
  59.         else:
  60.             content = json.loads(requests.get(TINDER_TEASER_URL, headers=headers).content)
  61.             url = content["data"]["teaser_url"]
  62.         if args.chatty:
  63.             if "X-Padding" in content: content["X-Padding"] = "redacted"
  64.             print(f"get_teaser_id(): url={url}")
  65.         return re.findall(re_extract, url)[0]
  66.     except Exception as e:
  67.         print("Couldn't access your likes. This probably means your x-auth-token is incorrect or outdated.", e)
  68.         return None
  69.  
  70.  
  71. # send like to given user_id
  72. def send_like(user_id):
  73.     response = json.loads(requests.post(TINDER_LIKE_URL.replace("USER_ID", user_id), headers=headers).content)
  74.     if args.chatty:
  75.         if "X-Padding" in response: response["X-Padding"] = "redacted"
  76.         print(f"send_like({user_id}): {response}")
  77.     try:
  78.         return response["status"] == 200 and response["match"] != False
  79.     except Exception as e:
  80.         print("Couldn't send a 'like' to Tinder. This probably means your x-auth-token is incorrect or outdated.", e)
  81.         return False
  82.  
  83.  
  84. # generate body for post request containing a random "s_number"
  85. def generate_body():
  86.     s = ''
  87.     for i in range(16):
  88.         s = s + str(randint(0,9))
  89.     return {"s_number": int(s)}
  90.  
  91.  
  92. # go as long as there are likes or the script fails otherwise
  93. adored = True
  94. match_count = 0
  95. 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/")
  96. print(f"\rMatches so far: {match_count}", end="")
  97. while adored:
  98.     # make sure retrieving user id and sending like were successful
  99.     success = send_like(get_teaser_id())
  100.     if not success:
  101.         success = send_like(get_teaser_id(recent=True))
  102.     if success:
  103.         # increase number of matches, print status, wait a bit (just to be safe)
  104.         match_count += 1
  105.         print(f"\rMatches so far: {match_count}", end="")
  106.         time.sleep(1)
  107.     else:
  108.         # end the loop
  109.         adored = False
  110. print("\nIf you liked this script and got money to spare, consider donating to charity :)")
  111.  
  112.        
  113.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement