Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import time
- import sys
- import os
- import requests
- import re
- import random
- import getpass
- import cfscrape
- ##
- ## CONFIG VARIABLES : YOU CAN EDIT THESE VARIABLES TO CHANGE TIMER VALUES ##
- ##
- MIN_DELAY_BETWEEN_PROFILE_VIEWS = 1
- MAX_DELAY_BETWEEN_PROFILE_VIEWS = 3
- DELAY_BETWEEN_RUNS = 5
- sex = 'FEMALE' # Possible values: 'MALE', 'FEMALE', or empty '' for both
- age1 = 18 # minimum age
- age2 = 25 # maximum age
- # We keep already visited profile in a file to avoid visiting
- # a profile multiple times on consecutive execution of this script
- # YOU CAN DELETE THIS FILE IF YOU WANT TO VISIT EVERYBODY ONCE AGAIN
- visitedUsersFilename = 'users_visited.txt'
- # Set this variable to True to output debug log,
- # or False for more concise output
- DEBUG = True
- ##
- ## END OF CONFIG VARIABLES
- ##
- offset1 = 0
- offset2 = 0
- sessioncount = 0
- run_number = 1
- f = open(visitedUsersFilename, 'a+')
- processedUsers = [line.strip() for line in f]
- print ("Already processed" + str(len(processedUsers)) + ' users.')
- countrycode = input('\nCountry code (e.g. Germany = DE): ' )
- countrycode = countrycode.upper()
- onlinestatus = input('View online members only? (Y/N): ')
- onlinestatus = onlinestatus.upper()
- if onlinestatus == 'Y':
- onlinestatus='true'
- else:
- onlinestatus='false'
- s = cfscrape.CloudflareScraper(js_engine='Node')
- login = input('Username (): ')
- password = getpass.getpass('Password: ')
- payload = {'action': 'login',
- 'login': login,
- 'auto_login' : '0',
- 'password': password}
- print ("Logging in...")
- s.get("https://www.interpals.net/app/auth/login")
- r = s.post("https://www.interpals.net/app/auth/login", data=payload)
- print ("Logged in: Starting the dance \o/")
- time.sleep(2)
- #print r.headers
- #print r.text
- while True:
- runcount = 0
- if DEBUG:
- print("Fetching the search page...")
- r = s.get('https://www.interpals.net/app/search?todo=search&sort=last_login&age1=%d&age2=%d&sex[0]=%s&photo=1&online=%s&countries[0]=---&countries[0]=%s&offset=%d&offset=%d' % (age1, age2, sex, onlinestatus, countrycode, offset1, offset2))
- data = r.text
- print(data)
- for m in re.finditer('<b><a href=', data):
- username = data[m.start()+13:m.start()+28]
- if '?' in username:
- mesto = username.index('?')
- username = username[:mesto]
- if username not in processedUsers:
- if DEBUG:
- print ('Visiting profile of ' + username + ' (' + str(sessioncount) + ')')
- runcount += 1
- sessioncount += 1
- r = s.get('https://www.interpals.net/' + username)
- waitTime = random.randrange(MIN_DELAY_BETWEEN_PROFILE_VIEWS*10, MAX_DELAY_BETWEEN_PROFILE_VIEWS*10) / float(10)
- if DEBUG:
- print ('Waiting ' + str(waitTime) + 's')
- else:
- os.system('cls' if os.name=='nt' else 'clear')
- print ('\rRun %d - Fetched %d users (%d total)' % (run_number, runcount, sessioncount))
- time.sleep(waitTime)
- processedUsers.append(username)
- f.write(username + '\n')
- elif DEBUG:
- print ('Already visited ' + username)
- run_number += 1
- offset1=offset1+20
- offset2=offset1+20
- if (runcount < 20):
- print ('[-] Waiting (%d)s before next run (fetched %d users this run, %d total)\n' % (DELAY_BETWEEN_RUNS, runcount, sessioncount))
- time.sleep(DELAY_BETWEEN_RUNS)
- else:
- print ('[+] Waiting (%d)s before next run (fetched %d users this run, %d total)\n' % (DELAY_BETWEEN_RUNS, runcount, sessioncount))
- time.sleep(DELAY_BETWEEN_RUNS)
- # This script is ugly. It was made rapidly, for fun. At least, it does its job.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement