Advertisement
Guest User

Interpals with working history

a guest
Aug 2nd, 2015
871
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import time
  4. import sys
  5. import os
  6. import requests
  7. import re
  8. import random
  9. import getpass
  10.  
  11. ##
  12. ## CONFIG VARIABLES : YOU CAN EDIT THESE VARIABLES TO CHANGE TIMER VALUES ##
  13. ##
  14. MIN_DELAY_BETWEEN_PROFILE_VIEWS = 1
  15. MAX_DELAY_BETWEEN_PROFILE_VIEWS = 5
  16. DELAY_BETWEEN_RUNS = 30
  17. sex = 'female' # Possible values: 'male', 'female', or empty '' for both
  18. cont = 'OC' # Possible values: 'AF' (Africa) 'AS' (Asia), 'EU' (Europe)
  19. #'NA' (North America), 'OC' (Oceania), 'SA' (South America)
  20. age1 = 20 # minimum age
  21. age2 = 50 # maximum age
  22.  
  23. # We keep already visited profile in a file to avoid visiting
  24. # a profile multiple times on consecutive execution of this script
  25. # YOU CAN DELETE THIS FILE IF YOU WANT TO VISIT EVERYBODY ONCE AGAIN
  26. visitedUsersFilename = "users_visited.txt"
  27.  
  28. # Set this variable to True to output debug log,
  29. # or False for more concise output
  30. DEBUG = False
  31. ##
  32. ## END OF CONFIG VARIABLES
  33. ##
  34.  
  35.  
  36. sessioncount = 0
  37. run_number = 1
  38. f_to_write = open(visitedUsersFilename, 'a+')
  39. with open(visitedUsersFilename) as f:
  40. processedUsers = [x.strip('\n') for x in f.readlines()]
  41. if DEBUG:
  42. for p in processedUsers: print p
  43. print "Already processed " + str(len(processedUsers)) + " users."
  44. s = requests.Session()
  45. login = raw_input('Username (mail): ')
  46. password = getpass.getpass('Password: ')
  47. payload = {'action': 'login',
  48. 'login': login,
  49. 'auto_login' : '0',
  50. 'password': password}
  51.  
  52. print "Logging in..."
  53. s.get("http://www.interpals.net/")
  54. r = s.post("http://www.interpals.net/login.php", data=payload)
  55. print "Logged in: Starting the dance \o/"
  56. time.sleep(2)
  57. #print r.headers
  58. #print r.text
  59. while True:
  60. runcount = 0
  61. if DEBUG:
  62. print "Fetching online users page..."
  63. r = s.get("http://www.interpals.net/online.php?sex=%s&cont=%s&age1=%d&age2=%d" % (sex, cont, age1, age2))
  64. data = r.text
  65. usernames = re.findall(r'<div class=\'online_prof\'><a href=\'([a-zA-Z0-9\-_]+)\'', data, re.M)
  66. for username in usernames:
  67. if username not in processedUsers:
  68. if DEBUG:
  69. print "Visiting profile of " + username + " (" + str(sessioncount) + ")"
  70. runcount += 1
  71. sessioncount += 1
  72. r = s.get("http://www.interpals.net/" + username)
  73. waitTime = random.randrange(MIN_DELAY_BETWEEN_PROFILE_VIEWS*10, MAX_DELAY_BETWEEN_PROFILE_VIEWS*10) / float(10)
  74. if DEBUG:
  75. print "Waiting " + str(waitTime) + "s"
  76. else:
  77. os.system('cls' if os.name=='nt' else 'clear')
  78. print ('\rRun %d - Fetched %d users (%d total)' % (run_number, runcount, sessioncount))
  79. time.sleep(waitTime)
  80. processedUsers.append(username)
  81. f_to_write.write(username + "\n")
  82. elif DEBUG:
  83. print "Already visited " + username
  84. run_number += 1
  85. if (runcount < 20):
  86. print ('[-] Waiting (%d)s before next run (fetched %d users this run, %d total)\n' % (DELAY_BETWEEN_RUNS * 4, runcount, sessioncount))
  87. time.sleep(DELAY_BETWEEN_RUNS * 4)
  88. else:
  89. print ('[+] Waiting (%d)s before next run (fetched %d users this run, %d total)\n' % (DELAY_BETWEEN_RUNS, runcount, sessioncount))
  90. time.sleep(DELAY_BETWEEN_RUNS)
  91.  
  92. # 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