Advertisement
Guest User

Untitled

a guest
Jun 5th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. import requests
  2. import time
  3. import sys
  4. import os
  5. os.system("color 04")
  6.  
  7. print("[SYSTEM]: Bot successfully loaded & online.")
  8. print("[SYSTEM]: Selected service: Shirts")
  9. print("[SYSTEM]: Price: Normal")
  10. print(" ")
  11.  
  12.  
  13. class RobloxBot:
  14. """A simple Roblox bot class"""
  15. def __init__(self, group_id):
  16. self.headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0'}
  17. self.session = requests.session()
  18. self.session.headers.update(self.headers)
  19. self.group_id = group_id
  20. if requests.get('https://pastebin.com/raw/QmT75pG7').text != 'Updated by googledmusic lole':
  21. sys.exit('[FAILED]: Unable to connect')
  22.  
  23. def login(self, username, password):
  24. print('[SYSTEM]: Logging in...')
  25. payload = {'username': username, 'password': password}
  26. self.session.post('https://www.roblox.com/newlogin', data=payload)
  27. print('[SYSTEM]: Successfully logged in')
  28.  
  29. def get_shirts(self, starting_page=66, category='12', wait=10):
  30. page_num = starting_page
  31. while page_num < 999999:
  32. params = {'CatalogContext': 66, 'Subcategory': category, 'SortAggregation': '5', 'LegendExpanded': 'true', 'Category': '3', 'PageNumber': page_num}
  33. try:
  34. r = self.session.get('https://www.roblox.com/catalog/json', params=params)
  35. r.raise_for_status()
  36. except requests.exceptions.HTTPError:
  37. print('[FAILED]: Status Error: {}'.format(r.status_code))
  38. time.sleep(30)
  39. continue
  40. for asset in r.json():
  41. while True:
  42. try:
  43. self.__download(asset['AssetId'])
  44. break
  45. except:
  46. continue
  47. time.sleep(wait)
  48. page_num += 1
  49.  
  50. def __download(self, assetId):
  51. data = self.session.get('https://api.roblox.com/Marketplace/ProductInfo', params={'assetId': assetId}).json()
  52. name, description, price, asset_type = data['Name'], data['Description'], data['PriceInRobux'], data['AssetTypeId']
  53. count = 0
  54. while count < 10:
  55. assetId -= 1
  56. try:
  57. r = self.session.get('https://api.roblox.com/Marketplace/ProductInfo', params={'assetId': assetId})
  58. count += 1
  59. r.raise_for_status()
  60. if r.json()['Name'] == name:
  61. break
  62. except (requests.exceptions.HTTPError, ValueError):
  63. return
  64. file = self.session.get('https://www.roblox.com/asset/', params={'id': assetId})
  65. self.__upload(name, description, price, file, asset_type, assetId)
  66.  
  67. def __upload(self, name, description, price, file, asset_type, assetId):
  68. r = self.session.get('https://www.roblox.com/build/upload')
  69. token = r.text.split('name=__RequestVerificationToken type=hidden value=')[-1].split('>')[0]
  70. data = {'file': ('template.png', file.content, 'image/png')}
  71. payload = {'__RequestVerificationToken': token, 'assetTypeId': asset_type, 'isOggUploadEnabled': 'True', 'isTgaUploadEnabled': 'True', 'groupId': self.group_id, 'onVerificationPage': 'False', 'name': name}
  72. r = self.session.post('https://www.roblox.com/build/upload', files=data, data=payload)
  73. asset_id = r.text.split('uploadedId=')[-1].split('" />')[0]
  74. assets = {'id': asset_id}
  75. r = self.session.get('https://www.roblox.com/my/item.aspx', params=assets)
  76. view_state = r.text.split('id="__VIEWSTATE" value="')[-1].split('" />')[0]
  77. view_gen = r.text.split('id="__VIEWSTATEGENERATOR" value="')[-1].split('" />')[0]
  78. validation = r.text.split('id="__EVENTVALIDATION" value="')[-1].split('" />')[0]
  79. payload = {'__EVENTTARGET': 'ctl00$cphRoblox$SubmitButtonBottom', '__EVENTARGUMENT': '', '__VIEWSTATE': view_state, '__VIEWSTATEGENERATOR': view_gen, '__EVENTVALIDATION': validation, 'ctl00$cphRoblox$NameTextBox': name, 'ctl00$cphRoblox$DescriptionTextBox': description, 'ctl00$cphRoblox$SellThisItemCheckBox': 'on', 'ctl00$cphRoblox$SellForRobux': 'on', 'ctl00$cphRoblox$RobuxPrice': price, 'ctl00$cphRoblox$EnableCommentsCheckBox': 'on', 'GenreButtons2': '1', 'ctl00$cphRoblox$actualGenreSelection': '1'}
  80. self.session.post('https://www.roblox.com/my/item.aspx', params=assets, data=payload)
  81. print('[SYSTEM]: Successfully uploaded'.format(assetId))
  82.  
  83. if __name__ == '__main__':
  84. bot = RobloxBot(group_id='4087907')
  85. bot.login(username='DarkLordVikeus', password='4#6y0$lb!xzm')
  86. bot.get_shirts(starting_page=16635, category='12', wait=2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement