daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #RR MemeBot v1.5 (Gold Refresh) (c) Meme 2018
  2.  
  3. while True:
  4.         #email, password & state id. must be google account
  5.         email = ''
  6.         passwd = ''
  7.         state_id = '2425'
  8.  
  9.         #imports
  10.         import requests
  11.         from webbot import Browser
  12.         import time
  13.         import linecache
  14.         import math
  15.  
  16.         s = requests.Session()
  17.        
  18.         #start log in
  19.         def logIn():
  20.             authText = requests.get("http://rivalregions.com").text
  21.  
  22.             authText1 = authText.split('\t<a href="')
  23.  
  24.             authText2 = authText1[1].split('" class="sa')
  25.  
  26.             #google login w/ requests is too hard so i did it the easy way, sue me
  27.             web = Browser(showWindow=False)
  28.             web.go_to(authText2[0])
  29.             print("Logging in...")
  30.             web.type(email , into = 'Email')
  31.             web.click('Next')
  32.             time.sleep(1)
  33.             web.type(passwd , into = 'Password')
  34.             web.click('Next')
  35.             time.sleep(5)
  36.             web.click(css_selector=".sa_sn.float_left.imp.gogo")
  37.             print('Logged in successfully under %s' % email)
  38.             time.sleep(3)
  39.  
  40.             #transfer and save account cookies
  41.             rr_content = web.get_cookie('PHPSESSID')
  42.  
  43.             #parse cookie so its usable
  44.             global expires
  45.             expires = rr_content.get('expiry', None)
  46.             rr_content.pop('expiry', None)
  47.             rr_content.pop('httpOnly', None)
  48.             rr_content['expires'] = expires
  49.  
  50.             #set cookie
  51.             s.cookies.set(**rr_content)
  52.  
  53.             home = s.get('http://rivalregions.com/#storage').text
  54.  
  55.             stats = home.split('span id="m">')
  56.             stats1 = stats[1].split('</span> G')
  57.             print('Money = %s' % (stats1[0].split('</span> $'))[0])
  58.             print('Gold = %s' % (stats1[0].split('span id="g">'))[1])
  59.             #done! logged in. saved unix cookie expire time
  60.         logIn()
  61.  
  62.         #enter requests loop
  63.         while True:
  64.             #if cookies expired; log in
  65.             if expires <= time.time():
  66.                 logIn()
  67.             source = (s.get('http://rivalregions.com/info/regions/%s' % state_id).text).splitlines()
  68.  
  69.             #find number of regions in state
  70.             reg_num = (len(source)-104)/67
  71.  
  72.             #select starting point in lines
  73.             n = 103
  74.             m = 119
  75.             o = 126
  76.            
  77.             #start for loop
  78.             for i in range(int(reg_num)):
  79.                 #parse line to find region id
  80.                 reg1 = source[n].split('id:&nbsp;')
  81.                 region = reg1[1].split('</td>')
  82.                 #parse line to find current gold, max gold and do math
  83.                 curgold1 = source[m].split('#858300;">')
  84.                 curgold = curgold1[1].split('</gold>')
  85.                 maxgold1 = source[o].split('#858300;">')
  86.                 maxgold = maxgold1[1].split('</td>')
  87.                 refresh = int(maxgold[0]) - math.trunc(float(curgold[0]))
  88.                 m += 67
  89.                 o += 67
  90.                 n += 67
  91.  
  92.                 #send law
  93.                 s.get('http://rivalregions.com/parliament/donew/18/0_%s/%s' % (refresh, region[0]))
  94.                 print('posted law for region %s for %s gold' % (region[0], refresh))
  95.             time.sleep(1800)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top