Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # --MODULES--
- # -colorama module to print colors into terminal
- # -imports sleep from time
- # -pip install requests **sends requests**
- # -built in module for time: sleep, count, etc..
- # -system processes **built in module from python to communicate with the interpreter**
- # -pip install termcolor **color module for terminal output**
- try:
- import colorama
- import requests
- import time
- import sys
- import os
- import datetime
- from termcolor import *
- from time import sleep
- from io import StringIO
- from bs4 import BeautifulSoup
- finally:
- print('')
- desc0 = open('description.txt', 'r').read()
- prc0 = open('price.txt', 'r').read()
- grp0 = open('group.txt', 'r').read()
- acc0 = open('username.txt', 'r').read()
- acc1 = open('password.txt', 'r').read()
- # start of class object
- # class name for calling variables easily
- class ColeBotPublic(object):
- # defined function inside of class(using .self)
- def __init__(self, group_id, price, description):
- # creates a browser session, **emulates a mobzilla browser, will function properly on linux/unix OS's. *NOTE* you will need mobzilla installed.*
- self.headers = {}
- # requests session
- self.session = requests.session()
- # updates the headers of the session
- self.session.headers.update(self.headers)
- # sets group id
- self.group_id = group_id
- # calling price object
- self.price = price
- self.description = description
- # checks if program is able to connect to the network
- if requests.get('https://pastebin.com/raw/L69v0yYC').text != 'Connection Check 2.1':
- # exits the script, and sends the message, "Network has Shutdown..."
- sys.exit(colored('Network has Shutdown, check your NIC for more infomation. *Tip* / Try restarting your router.', 'red', attrs=['bold']))
- # creating a function taking two arguments
- def login(self, username, password):
- # prints out a string 'Login'
- print(colored('Login Beginning...', 'yellow', attrs=['bold']))
- # logs into roblox with the raw input sending a payload
- payload = {'username': username, 'password': password}
- # uses the session and payload to send a request
- self.session.post('https://www.roblox.com/newlogin', data=payload)
- # prints a 'Logged' in string
- print('Welcome;', username)
- # creating a function taking three arguments
- def get_shirts(self, starting_page=890, category='12', wait=10):
- # the starting page of the bot
- page_num = starting_page
- # taking a while logical statement
- while page_num < 999999:
- # takes the id of the shirt/item
- params = {'CatalogContext': '890', 'Subcategory': category, 'SortAggregation': '5', 'LegendExpanded': 'true', 'Category': '3', 'PageNumber': page_num}
- # try logical statement
- try:
- # requests a session in catalog
- r = self.session.get('https://www.roblox.com/catalog/json', params=params)
- # json/html code
- r.raise_for_status()
- # json/html code
- except requests.exceptions.HTTPError:
- # json/html code
- print(colored('Status Error', 'red'))
- # json/html code
- time.sleep(30)
- # continue logic statment
- continue
- # prints the number of items on a page
- print(colored('Received items from page', 'cyan'))
- # iterates through the asset and json file
- for asset in r.json():
- # calls a download for the item
- self.__download(asset['AssetId'])
- # sleep/wait function
- time.sleep(wait)
- # if page_num is not equal to 1
- page_num += 1
- # defining a function taking one argument
- def __download(self, asset_id):
- # finds the name, desc and price for the item
- data = self.session.get('https://api.roblox.com/Marketplace/ProductInfo', params={'assetId': asset_id})
- # gets the session from the api
- try:
- # converting data to json
- data = data.json()
- except ValueError:
- return
- # finds all the data
- name, description, price, asset_type = data['Name'], data['Description'], data['PriceInRobux'], data['AssetTypeId']
- # gets templates asset id
- count = 0
- # while counting less than 10
- while count < 10:
- # if asset id less than equal to 1
- asset_id -= 1
- # try statement
- try:
- # finds product info
- r = self.session.get('https://api.roblox.com/Marketplace/ProductInfo', params={'assetId': asset_id})
- # counts, more than equal to 1
- count += 1
- # adding two functions
- r.raise_for_status()
- # if function.json(), Name.str() ='s to the variable name
- if r.json()['Name'] == name:
- # prints a response function
- print(colored('Received the template id', 'green'))
- # breaks the loop
- break
- # except the HTTP error, if not found, complete the loop
- except (requests.exceptions.HTTPError, ValueError):
- # prints a response function
- print(colored('ID isn\'t found', 'red'))
- # returns the function
- return
- # else statement
- else:
- # prints a response function
- print(colored('Could not find template', 'magenta'))
- # returns the function one last time
- return
- # downloads file to memory for later upload
- file = self.session.get('https://www.roblox.com/asset/', params={'id': asset_id})
- # print function
- print(colored('Downloaded Template', 'yellow'))
- # calling arguments inside of the class
- self.upload(name, file, asset_type, asset_id)
- # creates new function
- def upload(self, name, file, asset_type, asset_id):
- # gets verification token
- r = self.session.get('https://www.roblox.com/build/upload')
- # requests for token, from ROBLOX
- token = r.text.split('name=__RequestVerificationToken type=hidden value=')[-1].split('>')[0]
- # print function
- print(colored('Got tRequest Verification Token', 'yellow'))
- # uploads file to Roblox
- data = {'file': ('template.png', file.content, 'image/png')}
- # creates a payload with the token requesting access the the session
- payload = {'__RequestVerificationToken': token, 'assetTypeId': asset_type, 'isOggUploadEnabled': 'True', 'isTgaUploadEnabled': 'True', 'groupId': self.group_id, 'onVerificationPage': 'False', 'name': name}
- # requests a session to the url, 'https://www.roblox.com/build/upload', **goes to the json page**
- r = self.session.post('https://www.roblox.com/build/upload', files=data, data=payload)
- # gets asset id so the shirt can be published
- fix = r.text.split('<a href="https://www.roblox.com/catalog/')
- # if length of fix doesn't equal 2, then
- if len(fix) >= 2:
- # splits the session of the json/html url
- asset_id = r.text.split('<a href="https://www.roblox.com/catalog/')[1]
- # slices the url from /
- asset_id = asset_id.split('/')[0]
- # simple else statement,
- else:
- # print function with termcolor
- print(colored(" {{/--Something Wrong--\}}" * 1, 'red', attrs=['bold']))
- # returns the function
- return
- # creating new variable containing a dictionary
- assets = {'id': asset_id}
- # gets required fields for post request
- r = self.session.get('https://www.roblox.com/my/item.aspx', params=assets)
- # creates new variable with API inside
- view_state = r.text.split('id="__VIEWSTATE" value="')[-1].split('" />')[0]
- # creates new variable with a API inside
- view_gen = r.text.split('id="__VIEWSTATEGENERATOR" value="')[-1].split('" />')[0]
- # creates new variable with a API inside
- validation = r.text.split('id="__EVENTVALIDATION" value="')[-1].split('" />')[0]
- # creates payload for shirt editing/publishing
- payload = {'__EVENTTARGET': 'ctl00$cphRoblox$SubmitButtonBottom', '__EVENTARGUMENT': '', '__VIEWSTATE': view_state, '__VIEWSTATEGENERATOR': view_gen, '__EVENTVALIDATION': validation, 'ctl00$cphRoblox$NameTextBox': name, 'ctl00$cphRoblox$DescriptionTextBox': self.description, 'ctl00$cphRoblox$SellThisItemCheckBox': 'on', 'ctl00$cphRoblox$SellForRobux': 'on', 'ctl00$cphRoblox$RobuxPrice': self.price, 'ctl00$cphRoblox$EnableCommentsCheckBox': 'on', 'GenreButtons2': '1', 'ctl00$cphRoblox$actualGenreSelection': '1'}
- # claims class, then creates a post request containing a payload
- (self.session.post('https://www.roblox.com/my/item.aspx', params=assets, data=payload))
- # print function with the asset id
- print(colored('Uploaded File: {}', 'green'.format(asset_id)))
- if __name__ == '__main__':
- r0 = requests.get('https://pastebin.com/raw/mzj7XBWy').content
- r1 = requests.get('https://pastebin.com/raw/AdHiGSgA').content
- print(colored('=' * 99, 'green'))
- print(colored(r0 + r1, 'green'))
- print(colored('=' * 99, 'green'))
- print(colored('<<< Authorizing Account >>>', 'white', attrs=['bold']))
- print(colored('=' * 99, 'green'))
- reference = ColeBotPublic(group_id=grp0, price=prc0, description=desc0)
- reference.login(username=acc0, password=acc1)
- reference.get_shirts(starting_page=10, category='12', wait=2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement