Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. s = requests.session()
  5. login_url = "http://socialclub.rockstargames.com/profile/signin"
  6.  
  7. #get the token needed to log in
  8. tmp=s.get("http://socialclub.rockstargames.com")
  9.  
  10. findtoken = BeautifulSoup(tmp.content, "lxml")
  11. token=findtoken.find("__RequestVerificationToken")
  12. #__________________________________
  13.  
  14. username = 'smittyofwar@mail.com'
  15. passwrd='Harambe1'
  16.  
  17. data = dict(login=username, password=passwrd,__RequestVerificationToken=token, next='/')
  18.  
  19. s.post(login_url, data=data,headers=dict(Referer="http://socialclub.rockstargames.com"))
  20.  
  21.  
  22.  
  23. r = s.get("http://socialclub.rockstargames.com")
  24. #r = s.get("https://socialclub.rockstargames.com/member/cjg320/games/gtav/career/overview/gtaonline")
  25.  
  26. soup = BeautifulSoup(r.content, "lxml")
  27. soup = soup.prettify()
  28.  
  29.  
  30. with open('thesauce.txt', 'w', encoding='utf-8') as f:
  31. for line in soup:
  32. f.write(str(line))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement