Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WowYiJiu committed Oct 15, 2024
1 parent a5fd064 commit ba628be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

### 使用说明

> 使用时需关掉 2FA
> `telegram_info_export.exe``config.ini`放在同一目录下
- `api_id``api_hash`需要到[Telegram 开发者平台](https://my.telegram.org/auth)申请
- proxy_url 格式
Expand Down
14 changes: 12 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import tkinter as tk
from ttkthemes import ThemedTk
from openpyxl import load_workbook
from telethon import errors
from telethon.sync import TelegramClient
from telethon.tl.types import User
from tkinter import ttk, simpledialog
Expand Down Expand Up @@ -34,13 +35,22 @@ def get_telegram_info(self, api_name, api_id, api_hash, phone_number, proxy_url)
client.connect()
self.log("连接成功")


if not client.is_user_authorized():
self.log("当前账号需要验证")
self.log("当前账号需要验证码")
client.send_code_request(phone_number)
verification_code = simpledialog.askstring(
title="验证码", prompt="请输入验证码:"
)
client.sign_in(phone_number, verification_code)
try:
client.sign_in(phone_number, verification_code)
except errors.SessionPasswordNeededError:
self.log("当前账号需要二步验证")
password = simpledialog.askstring(
title="密码", prompt="请输入二步验证密码:", show='*'
)
client.sign_in(password=password)

self.log("登陆成功")

self.log("正在获取对话信息")
Expand Down

0 comments on commit ba628be

Please sign in to comment.