NAME
TGConvertor — Convert Telegram session files between Pyrogram, Kurigram, Telethon and TDATA formats. Simple, fast, and CLI-friendly.
SYNOPSIS
pip install TGConvertorINFO
DESCRIPTION
Convert Telegram session files between Pyrogram, Kurigram, Telethon and TDATA formats. Simple, fast, and CLI-friendly.
README
TGConvertor 
This module is small util for easy converting Telegram sessions to various formats (Telethon, Pyrogram, Kurigram, Tdata)
Installation
with Pyrogram support
$ pip install TGConvertor[pyrogram]
with Kurigram support
$ pip install TGConvertor[kurigram]
Using CLI
After installation, you can use the tgconvertor command-line tool:
# Show help and available commands tgconvertor --helpList supported formats and API types
tgconvertor list-formats
Converting Sessions
The main convert command supports various conversion scenarios:
# Convert from file to file tgconvertor convert session.session -f telethon -t pyrogram -o new_session.sessionConvert from string to file
tgconvertor convert "1:AAFqwer..." -f telethon -t pyrogram -o session.session
Convert from file to string
tgconvertor convert session.session -f telethon -t pyrogram -o string
Convert from string to string
tgconvertor convert "1:AAFqwer..." -f telethon -t pyrogram -o string
Convert from string to tdata
tgconvertor convert "1:AAFqwer..." -f telethon -t tdata -o tdata_folder
Convert from tdata to string
tgconvertor convert tdata_folder/tdata -f tdata -t telethon -o string
Use specific API type (desktop/android/ios/macos/web)
tgconvertor convert session.session -f telethon -t pyrogram --api android
View Session Information
You can inspect session details using the info command:
# Show Telethon session info tgconvertor info session.session -f telethonShow Pyrogram session info
tgconvertor info my_session.session -f pyrogram
Supported Formats
telethon: Telethon session files (.session)pyrogram: Pyrogram session files (.session)tdata: Telegram Desktop format (directory)
API Types
desktop: Telegram Desktop client (default)android: Telegram Android clientios: Telegram iOS clientmacos: Telegram macOS clientweb: Telegram Web client
Quickstart (Python API)
from TGConvertor import SessionManagerConvert from string
session = SessionManager.from_pyrogram_string('session_str') print(session.to_pyrogram_string())
Convert from file
session = await SessionManager.from_telethon_file('session.session') await session.to_pyrogram_file('new_session.session')
How it works
An authorization session consists of an authorization key and some additional data required to connect. The module simply extracts this data and creates an instance of TelegramSession based on it, the methods of which are convenient to use to convert to the format you need.
Donate
USDT (BEP20): 0x34412717daaf427efa39c8508db4f62cce0d6d48