Advertisement
Guest User

Profile stuff

a guest
Oct 31st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. import re, urllib.request,urllib.parse
  2. username = ""
  3. password = ""
  4. mini = ""
  5.  
  6. def rainbow(word):
  7. length = len(word)
  8. #set rgb values
  9. r = 255 #rgb value set to red by default
  10. g = 0
  11. b = 0
  12. sub = int(765/length)
  13. counter = 0
  14. string = ""
  15. for x in range(0, length):
  16. letter = word[counter]
  17. s = "<f x12%02X%02X%02X='0'>%s" % (r, g, b, letter)
  18. string = string+s
  19. counter+=1
  20. if (r == 255) and (g >= 0) and (b == 0): #if all red
  21. g = g+sub
  22. if g > 255: g = 255
  23. if (r > 0) and (g == 255) and (b == 0): #if some red and all green
  24. r = r-sub #reduce red to fade from yellow to green
  25. if r<0: r = 0 #if red gets lower than 0, set it back to 0
  26. if (r == 0) and (g == 255) and (b >= 0):
  27. b = b+sub
  28. if b>255:
  29. b = 255
  30. trans = True
  31. if (r == 0) and (g > 0) and (b == 255):
  32. g = g-sub
  33. if g<0: g = 0
  34. if (r >= 0) and (g == 0) and (b == 255):
  35. r = r+sub
  36. if r>255: r = 255
  37. return str(string).replace("<f x12","<font color=\"#").replace("='0'","\"")
  38. print(rainbow("TEXT HERE"))
  39.  
  40. def authToken(u, p):
  41. token = urllib.request.urlopen("http://chatango.com/login", urllib.parse.urlencode({"user_id": username.lower(), "password": password, "storecookie": "on", "checkerrors": "yes" }).encode()).getheader("Set-Cookie")
  42.  
  43. return re.search("auth.chatango.com=(.*?);", token).group(1)
  44. print(authToken(username,password))
  45. def edit_profile(u,p,edit):
  46. token = authToken(username, password)
  47. url = "http://%s.chatango.com/updateprofile?flash&d&s=%s" % (username.lower(), token)
  48. Data = urllib.parse.urlencode({"checkerrors": "yes", "full_profile": "", "uns":"1","line":rainbow(edit),"email": "", "location":"","gender":"","age":""}).encode()
  49. headers = {"Cookie":"auth.chatango.com=%s" % token}
  50. req = urllib.request.Request(url, data=Data, headers=headers)
  51. urllib.request.urlopen(req)
  52. print("successful")
  53. edit_profile(username,password,mini)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement