Advertisement
Guest User

Untitled

a guest
Apr 4th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. import requests
  2. import os
  3. import time
  4. import random
  5. import re
  6. from BeautifulSoup import BeautifulSoup
  7.  
  8. Session = requests.Session()
  9.  
  10. class Forum(object):
  11. def __init__(self):
  12. self.Source = ''
  13.  
  14. def getThread(self, ForumID, Session):
  15. Request = Session.get('https://forum.roblox.com/Forum/ShowForum.aspx?ForumID=' + str(ForumID)).content;
  16. Number = random.randint(3, 10);
  17. PostID = re.findall('PostID=(\d+)', Request)[1+Number];
  18. return PostID
  19.  
  20. def getForumText(postID, account, number):
  21. forumTextUrl =('https://forum.roblox.com/Forum/ShowPost.aspx?PostID=' + str(postID))
  22. forumHtml2 = BeautifulSoup(account.get(forumTextUrl).content)
  23. forumPost = forumHtml2.findAll('span', attrs={'class': 'normalTextSmall notranslate linkify'})
  24. return forumPost[int(number)].getText()
  25.  
  26. def login(username, password):
  27. newSession = requests.Session()
  28. loginRequest = newSession.post('https://m.roblox.com/login',
  29. data = {
  30. 'UserName': username,
  31. 'Password': password
  32. }
  33. )
  34. return newSession
  35.  
  36.  
  37. def main():
  38. thread = ForumAPI.getThread('35', Session)
  39. print(thread)
  40. text = getForumText(thread, var.account, 0)
  41. print(text)
  42. save = ("'" + str(text) + "',")
  43. file = open("text.txt","w")
  44. file.write(save)
  45. time.sleep(25)
  46. main()
  47.  
  48. class var:
  49. account = login('qww', 'lollol123')
  50. clr = os.system('clear')
  51. ForumAPI = Forum()
  52.  
  53.  
  54. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement