Update superproperties.py
use requests wrapper instead of s.get
@@ -4,6 +4,7 @@ import ua_parser.user_agent_parser
import re
import time
+from ..RESTapiwrap import *
from ..logger import Logger
class SuperProperties:
@@ -11,17 +12,17 @@ class SuperProperties:
https://luna.gitlab.io/discord-unofficial-docs/science.html#super-properties-object
'''
def __init__(self, s, buildnum="request", log={"console":True, "file":False}):
- self.s = s
+ self.editedS = Wrapper.editedReqSession(s, {"remove": ["Authorization"]})
self.buildnum = buildnum
self.log = log
def requestBuildNumber(self):
if self.log: print("Retrieving Discord's build number...")
- discord_login_page_exploration = self.s.get('https://discord.com/login').text
+ discord_login_page_exploration = Wrapper.sendRequest(self.editedS, 'get', "https://discord.com/login", log=False).text #log set to False cause this takes up console space w/o giving meaningful info
time.sleep(1)
try: #getting the build num is kinda experimental since who knows if discord will change where the build number is located...
file_with_build_num = 'https://discord.com/assets/'+re.compile(r'assets/+([a-z0-9]+)\.js').findall(discord_login_page_exploration)[-2]+'.js' #fastest solution I could find since the last js file is huge in comparison to 2nd from last
- req_file_build = self.s.get(file_with_build_num).text
+ req_file_build = Wrapper.sendRequest(self.editedS, 'get', file_with_build_num, log=False).text #log set to False cause this is a big file
index_of_build_num = req_file_build.find('buildNumber')+14
discord_build_num = int(req_file_build[index_of_build_num:index_of_build_num+5])
Logger.log('Discord is currently on build number '+str(discord_build_num), None, self.log)
