SHARE
TWEET

Untitled

a guest Nov 19th, 2019 181 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import discord
  2. from discord.ext.commands import Bot
  3. import asyncio, json, requests
  4. import random
  5. from bs4 import BeautifulSoup
  6. import os, time, re, subprocess
  7. with open('config.json') as (f):
  8.     data = json.load(f)
  9. TOKEN = data['token']
  10. BOT_PREFIX = data['prefix']
  11. client = Bot(command_prefix=BOT_PREFIX)
  12.  
  13. def grab_accounts(US, GB, DE, CA, CH, FR, SE):
  14.     f = open('Accounts/US.txt', 'r')
  15.     for line in f:
  16.         clean = line.split('\n')
  17.         US.append(clean[0])
  18.  
  19.     f.close()
  20.     f = open('Accounts/GB.txt', 'r')
  21.     for line in f:
  22.         clean = line.split('\n')
  23.         GB.append(clean[0])
  24.  
  25.     f.close()
  26.     f = open('Accounts/DE.txt', 'r')
  27.     for line in f:
  28.         clean = line.split('\n')
  29.         DE.append(clean[0])
  30.  
  31.     f.close()
  32.     f = open('Accounts/CA.txt', 'r')
  33.     for line in f:
  34.         clean = line.split('\n')
  35.         CA.append(clean[0])
  36.  
  37.     f = open('Accounts/CH.txt', 'r')
  38.     for line in f:
  39.         clean = line.split('\n')
  40.         CH.append(clean[0])
  41.  
  42.     f = open('Accounts/FR.txt', 'r')
  43.     for line in f:
  44.         clean = line.split('\n')
  45.         FR.append(clean[0])
  46.  
  47.     f = open('Accounts/SE.txt', 'r')
  48.     for line in f:
  49.         clean = line.split('\n')
  50.         SE.append(clean[0])
  51.  
  52.  
  53.     f.close()
  54.  
  55.  
  56. @client.event
  57. @asyncio.coroutine
  58. def on_ready():
  59.     print('Ready')
  60.  
  61.  
  62. @client.command(pass_context=True)
  63. @asyncio.coroutine
  64. def redeem(ctx, arg1, arg2):
  65.     allowed_countries = ['US', 'GB', 'DE', 'CA', 'CH', 'FR', 'SE']
  66.     accounts = []
  67.     keys = []
  68.     country = arg1.upper()
  69.     if country in allowed_countries:
  70.         f = open('Accounts/' + str(country) + '.txt', 'r')
  71.         for line in f:
  72.             clean = line.split('\n')
  73.             accounts.append(clean[0])
  74.  
  75.         f.close()
  76.     if country not in allowed_countries:
  77.         return await (client.say('Sorry But the Country you Specified is Not Currently Offered'))
  78.     else:
  79.         check = re.compile('(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$)')
  80.         mat = check.match(str(arg2))
  81.         if mat:
  82.             result = None
  83.             while result != ',"success":true}':
  84.                 if len(accounts) == 0:
  85.                     await client.say('Sorry We Are Out of Stock on That Country')
  86.                     os.remove('Accounts/' + str(country) + '.txt')
  87.                     f = open('Accounts/' + str(country) + '.txt', 'a')
  88.                     for ELEM in accounts:
  89.                         f.write(ELEM + '\n')
  90.  
  91.                     f.close()
  92.                     break
  93.                 account = accounts.pop()
  94.                 account = random.choice(accounts)
  95.                 combo = account.split(':')
  96.                 USER = combo[0]
  97.                 PASS = combo[1]
  98.                 try:
  99.                     with requests.Session() as (c):
  100.                         url = 'https://accounts.spotify.com/en/login?continue=https:%2F%2Fwww.spotify.com%2Fint%2Faccount%2Foverview%2F'
  101.                         headers = {'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',  'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'}
  102.                         page = c.get(url, headers=headers)
  103.                         CSRF = page.cookies['csrf_token']
  104.                         headers = {'Accept':'*/*',  'User-Agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A403 Safari/602.1',  'Referer':'https://accounts.spotify.com/en/login/?continue=https:%2F%2Fwww.spotify.com%2Fus%2Fgooglehome%2Fregister%2F&_locale=en-US'}
  105.                         url = 'https://accounts.spotify.com/api/login'
  106.                         login_data = {'remember':'true',  'username':USER,  'password':PASS,  'csrf_token':CSRF}
  107.                         cookies = dict(__bon='MHwwfC0xNDAxNTMwNDkzfC01ODg2NDI4MDcwNnwxfDF8MXwx')
  108.                         login = c.post(url, headers=headers, data=login_data, cookies=cookies)
  109.                         if '{"displayName":"' in login.text:
  110.                             url = 'https://www.spotify.com/us/account/overview/'
  111.                             capture = c.get(url, headers=headers)
  112.                             csr = capture.headers['X-Csrf-Token']
  113.                             url = 'https://www.spotify.com/us/family/api/master-invite-by-email/'
  114.                             headers = {'Accept':'*/*',  'User-Agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A403 Safari/602.1',  'x-csrf-token':csr}
  115.                             login_data = {'firstName':'thomas',  'lastName':'Payne',  'email':arg2}
  116.                             invite = c.post(url, headers=headers, json=login_data)
  117.                             print(invite.text)
  118.                             if '"success":true}' in invite.text:
  119.                                 await client.say('Success, check your email')
  120.                                 f.close()
  121.                                 break
  122.                             if 'message":"Invite limit reached' in invite.text:
  123.                                 result = None
  124.                                 return await(client.say('Invite limit reached. Please try again'))
  125.                                 accounts.pop()
  126.                             if 'message":"No family plan found for user' in invite.text:
  127.                                 result = None
  128.                                 return await(client.say('No plan found please try again'))
  129.                                 accounts.pop()
  130.                         if '{"error":"errorInvalidCredentials"}' in login.text:
  131.                             result = None
  132.                             return await(client.say('Invalid account was used from the DB please try again'))
  133.                             accounts.pop()
  134.                 except:
  135.                     pass
  136.  
  137.         if not mat:
  138.             return await (client.say('Sorry But an Invalid Email Was Given'))
  139.  
  140.  
  141. @client.command()
  142. @asyncio.coroutine
  143. def stock():
  144.     US_stock = []
  145.     GB_stock = []
  146.     DE_stock = []
  147.     CA_stock = []
  148.     CH_stock = []
  149.     FR_stock = []
  150.     SE_stock = []
  151.     grab_accounts(US_stock, GB_stock, DE_stock, CA_stock, CH_stock, FR_stock, SE_stock)
  152.     embed = discord.Embed(title='Stock',
  153.       colour=discord.Colour.blue())
  154.     embed.set_author(name='Inviter Bot', icon_url='https://cdn.discordapp.com/avatars/513839414322135062/b759fed29c2186046bfd6b7eff0bba5f.webp?size=128')
  155.     embed.add_field(name='US', value=len(US_stock), inline=True)
  156.     embed.add_field(name='GB', value=len(GB_stock), inline=True)
  157.     embed.add_field(name='DE', value=len(DE_stock), inline=True)
  158.     embed.add_field(name='CA', value=len(CA_stock), inline=True)
  159.     embed.add_field(name='CH', value=len(CH_stock), inline=True)
  160.     embed.add_field(name='FR', value=len(FR_stock), inline=True)
  161.     embed.add_field(name='SE', value=len(SE_stock), inline=True)
  162.     await client.say(embed=embed)
  163.  
  164.  
  165.  
  166. client.run(TOKEN)
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