updated
This commit is contained in:
@ -8,7 +8,7 @@ from telethon.sessions import StringSession
|
|||||||
from telethon.tl.functions.account import UpdateStatusRequest
|
from telethon.tl.functions.account import UpdateStatusRequest
|
||||||
from telethon.tl.functions.help import GetCountriesListRequest, GetNearestDcRequest
|
from telethon.tl.functions.help import GetCountriesListRequest, GetNearestDcRequest
|
||||||
from telethon.tl.functions.langpack import GetLangPackRequest
|
from telethon.tl.functions.langpack import GetLangPackRequest
|
||||||
from telethon.types import JsonNumber, JsonObject, JsonObjectValue
|
from telethon.types import JsonNumber, JsonObject, JsonObjectValue, JsonString
|
||||||
|
|
||||||
from .consts import API_PACKS
|
from .consts import API_PACKS
|
||||||
from .exceptions import ThonBannedError
|
from .exceptions import ThonBannedError
|
||||||
@ -118,9 +118,10 @@ class BaseData:
|
|||||||
return proxy
|
return proxy
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tz_offset(self) -> int | None:
|
def tz_offset(self) -> int:
|
||||||
if tz_offset := self.json_data.get("tz_offset"):
|
if tz_offset := self.json_data.get("tz_offset", 0):
|
||||||
return tz_offset
|
return tz_offset
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
class BaseThon(BaseData):
|
class BaseThon(BaseData):
|
||||||
@ -155,11 +156,26 @@ class BaseThon(BaseData):
|
|||||||
proxy=self.proxy,
|
proxy=self.proxy,
|
||||||
timeout=self.__timeout,
|
timeout=self.__timeout,
|
||||||
)
|
)
|
||||||
if self.tz_offset:
|
installer = JsonObjectValue("installer", JsonString("com.android.vending"))
|
||||||
tz_offset = JsonObjectValue("tz_offset", JsonNumber(self.tz_offset))
|
if self.app_id in (1, 8):
|
||||||
client._init_request.params = JsonObject([tz_offset])
|
installer = JsonObjectValue("installer", JsonString("com.apple.AppStore"))
|
||||||
client._init_request.lang_pack = API_PACKS.get(self.app_id, "android")
|
|
||||||
|
|
||||||
|
package = JsonObjectValue("package_id", JsonString("org.telegram.messenger"))
|
||||||
|
if self.app_id in (1, 8):
|
||||||
|
package = JsonObjectValue("package_id", JsonString("ph.telegra.Telegraph"))
|
||||||
|
|
||||||
|
perf_cat = JsonObjectValue("perf_cat", JsonNumber(2))
|
||||||
|
tz_offset = JsonObjectValue("tz_offset", JsonNumber(self.tz_offset))
|
||||||
|
if self.tz_offset:
|
||||||
|
client._init_request.params = JsonObject([tz_offset])
|
||||||
|
|
||||||
|
if self.app_id in (4, 6):
|
||||||
|
_list = [installer, package, perf_cat]
|
||||||
|
if self.tz_offset:
|
||||||
|
_list.append(tz_offset)
|
||||||
|
client._init_request.params = JsonObject(_list)
|
||||||
|
|
||||||
|
client._init_request.lang_pack = API_PACKS.get(self.app_id, "android")
|
||||||
return client
|
return client
|
||||||
|
|
||||||
async def get_additional_data(self):
|
async def get_additional_data(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user