LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!
https://docs.telethon.dev
MIT License
9.8k stars 1.39k forks source link

Some additional questions about other parameters of the TelegramClient. #4451

Open bupabupala opened 4 weeks ago

bupabupala commented 4 weeks ago

Describe your suggested feature

Hello, I have some questions regarding the use of Telethon. I am using v1, and I noticed that the TelegramClient allows specifying parameters such as device_model, app_version, system_version, etc. I purchased accounts that come with sessions from some websites, and these accounts also include JSON files. The format of these JSON files is as follows, containing some device information and app IDs.

{ "session_file":"2347044337245", "phone":"2347044337245", "register_time":1724129368, "app_id":2040, "app_hash":"b18441a1ff607e10a989891a5462e627", "sdk":"Windows 8", "app_version":"4.16.8 x64", "device":"HP Pavilion dv6", "last_check_time":1724129368, "avatar":"null", "first_name":"Qqqq", "last_name":null, "username":null, "sex":"null", "lang_code":"en", "system_lang_code":"en-US", "proxy":"null", "ipv6":false, "password_2fa":"285203" } I've searched through various resources but couldn't find how to use the JSON files that come with the session. I want to know if I am using them correctly and whether I need to pass these parameters. Although these app IDs are shared, when I use the device_model information from these JSON files, the accounts get banned, regardless of whether I use my own app ID or not. So, I want to know if these parameters need to be simulated? I haven't found any answers to these questions so far, so I would appreciate it if someone could take a look. Below is a portion of my code. Please forgive me if my English is not very accurate, as I am Chinese, and this is translated, so it might not be perfectly expressed.

json_fmt = read_json(f'{data_path_telethon}json/{account_.mobile}.json') if json_fmt is not None: app_version = json_fmt.get('app_version') device = json_fmt.get('device') app_id = json_fmt.get('app_id') app_hash = json_fmt.get('app_hash') twoFA = json_fmt.get('twoFA') password = json_fmt.get('password') lang_code = json_fmt.get('lang_code') system_lang_code = json_fmt.get('system_lang_code') sdk = json_fmt.get('sdk') agent_ = get_header_agent(account_.mobile) deviceInfo = DeviceInfo(model=device, version=sdk, app_version=app_version, app_agent=agent_) tg_client = TelegramClient( session=f'{data_path_telethon}/{account_.mobile}', api_id=app_id, api_hash=app_hash, proxy=proxy_dict, device_model=deviceInfo.model, app_version=deviceInfo.app_version, system_version=deviceInfo.version, system_lang_code=system_lang_code, lang_code=lang_code ) else: deviceInfo = iOSDeivce.RandomIosDevice(account_.mobile) tg_client = TelegramClient( session=f'{data_path_telethon}/{account_.mobile}', api_id=api_id, api_hash=api_hash, proxy=proxy_dict, device_model=deviceInfo.model, app_version=deviceInfo.app_version, system_version=deviceInfo.version, system_lang_code='en-US', lang_code='en' )

Checklist