Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import os
- import time
- import random
- import re
- from BeautifulSoup import BeautifulSoup
- Session = requests.Session()
- class Forum(object):
- def __init__(self):
- self.Source = ''
- def getThread(self, ForumID, Session):
- Request = Session.get('https://forum.roblox.com/Forum/ShowForum.aspx?ForumID=' + str(ForumID)).content;
- Number = random.randint(3, 10);
- PostID = re.findall('PostID=(\d+)', Request)[1+Number];
- return PostID
- def getForumText(postID, account, number):
- forumTextUrl =('https://forum.roblox.com/Forum/ShowPost.aspx?PostID=' + str(postID))
- forumHtml2 = BeautifulSoup(account.get(forumTextUrl).content)
- forumPost = forumHtml2.findAll('span', attrs={'class': 'normalTextSmall notranslate linkify'})
- return forumPost[int(number)].getText()
- def login(username, password):
- newSession = requests.Session()
- loginRequest = newSession.post('https://m.roblox.com/login',
- data = {
- 'UserName': username,
- 'Password': password
- }
- )
- return newSession
- def main():
- thread = ForumAPI.getThread('35', Session)
- print(thread)
- text = getForumText(thread, var.account, 0)
- print(text)
- save = ("'" + str(text) + "',")
- file = open("text.txt","w")
- file.write(save)
- time.sleep(25)
- main()
- class var:
- account = login('qww', 'lollol123')
- clr = os.system('clear')
- ForumAPI = Forum()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement