Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorSky authored Mar 21, 2024
1 parent 68acca6 commit 6cf6a79
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@
# header content-language: english: 'en-US', spanish: 'es-ES', ...
"logger-language": "en-US",
# send-activity cooldown
"activity-coldown": 5,
"activity-coldown": 6,
# api requests cooldown
"request-cooldown": 1,
# browse bots in the community (online)
"show-online": True,
"run-flask": True
}

PREFIX = '19'
Expand Down Expand Up @@ -80,7 +81,9 @@ def connected(self):
def build_headers(self, data=None, content_type=None):
headers = {
"NDCDEVICEID": self.device,
"SMDEVICEID": "b89d9a00-f78e-46a3-bd54-6507d68b343c",
"SMDEVICEID":
#"b89d9a00-f78e-46a3-bd54-6507d68b343c",
"36934779-e39a-4af7-9f98-9e737929598c",
"Accept-Language": parameters.get('logger-language', 'en-US'),
"Content-Type": "application/x-www-form-urlencoded; charset=utf-8",
"User-Agent": "Apple iPhone12,1 iOS v15.5 Main/3.12.2",
Expand All @@ -91,6 +94,7 @@ def build_headers(self, data=None, content_type=None):
if content_type:
headers["Content-Type"] = content_type
if data:
#headers["Content-Type"] = "application/json; charset=utf-8"
headers["NDC-MSG-SIG"] = self.generate_signature(data)
if self.sid:
headers["NDCAUTH"] = "sid=%s" % self.sid
Expand Down Expand Up @@ -166,7 +170,7 @@ def request(self, method, path, json, minify=False, ndcId=0, scope=False):
if minify:
data = json_minify(data)
else:
raise NotImplementedError(method)
raise NotImplementedError(method) from None
headers = self.build_headers(data)
return self.session.request(
method=method,
Expand Down Expand Up @@ -242,7 +246,7 @@ def __init__(self):
info = self.client.get_from_link(parameters["community-link"])
try: extensions = info["linkInfoV2"]["extensions"]
except KeyError:
raise RuntimeError('community: %s' % info["api:message"])
raise RuntimeError('community: %s' % info["api:message"]) from None
self.ndcId = extensions["community"]["ndcId"]
self.invitationId = extensions.get("invitationId")

Expand Down Expand Up @@ -296,7 +300,8 @@ def run(self):

if __name__ == "__main__":
os.system("cls" if os.name == 'nt' else "clear")
Thread(target=run).start()
if parameters.get("run-flask", False):
Thread(target=run).start()
try:
App().run()
except KeyboardInterrupt:
Expand Down

0 comments on commit 6cf6a79

Please sign in to comment.