Guest User

Untitled

a guest
Sep 2nd, 2016
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. import requests
  2. import re
  3. import time
  4. import sys
  5. from cleverbot import Cleverbot
  6. from random import randint
  7. sys.setrecursionlimit(100000);
  8. requests.packages.urllib3.disable_warnings();
  9.  
  10. #####
  11. Account = [raw_input('Username: '), raw_input('Password: ')];
  12. ID = raw_input('ID: ');
  13. Wait = 32;
  14. #####
  15. def getval(name, string):
  16. return re.search('id=\"' + name + '\" value=\"(.+)\"', string).group(1);
  17. def login(username, password, session):
  18. return session.post('https://m.roblox.com/login', data={'UserName':username,'Password':password});
  19. def getRandomThread(subforum, session):
  20. req1 = session.get('https://forum.roblox.com/Forum/ShowForum.aspx?ForumID=' + str(subforum)).content;
  21. number = randint(3, 10);
  22. postid = re.findall('PostID=(\d+)', req1)[1+number];
  23. return postid
  24. def getTitle(postid, session):
  25. req1 = session.get('https://forum.roblox.com/Forum/ShowPost.aspx?PostID=' + postid).content;
  26. title = re.search('20px\">(.+)<', req1).group(1);
  27. return title
  28. def reply(postid, body, session):
  29. req1 = session.get('https://forum.roblox.com/Forum/AddPost.aspx?PostID=' + str(postid)).content;
  30. reqdata = {
  31. '__EVENTTARGET': ' ', #getval('__EVENTTARGET', req1),
  32. '__EVENTARGUMENT': ' ', #getval('__EVENTARGUMENT', req1),
  33. '__VIEWSTATE': getval('__VIEWSTATE', req1),
  34. '__VIEWSTATEGENERATOR': getval('__VIEWSTATEGENERATOR', req1),
  35. '__EVENTVALIDATION': getval('__EVENTVALIDATION', req1),
  36. 'ctl00$cphRoblox$Createeditpost1$PostForm$PostBody': body,
  37. 'ctl00$cphRoblox$Createeditpost1$PostForm$PostButton': ' Post '
  38. }
  39. return session.post('https://forum.roblox.com/Forum/AddPost.aspx?PostID=' + str(postid), data=reqdata);
  40. #####
  41. ses = requests.Session();
  42. login(Account[0], Account[1], ses);
  43. print '-- CLEVERBOT FOR FORUM --'
  44. print '-- Made by DominusTrex --'
  45. print ' 1 day of use: ' + str(60 * 60 / 32 * 24) + ' posts'
  46. print ''
  47. def main():
  48. def main2():
  49. try:
  50. Siggy = 'There are only ' + str(randint(100, 1000)) + ' ducks left in the world.';
  51. threadid = getRandomThread(ID, ses);
  52. title = getTitle(threadid, ses);
  53. answer = (Cleverbot().ask(title) + '\n\n\n').lower() + Siggy;
  54. reply(threadid, answer, ses);
  55. print(threadid);
  56. except:
  57. main2();
  58. main2();
  59. time.sleep(Wait);
  60. main();
  61. main();
Add Comment
Please, Sign In to add comment