This module is small util for easy converting Telegram sessions to various formats.
Project description
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 --help
# List 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.session
# Convert 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 telethon
# Show 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 SessionManager
# Convert 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tgconvertor-0.1.4.tar.gz.
File metadata
- Download URL: tgconvertor-0.1.4.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e88c6c86a6eed150af3402ca6e20e901d880e943b57df163f6c258e415924f2
|
|
| MD5 |
b11b8220bf97f40fc58c5a892bcefd7a
|
|
| BLAKE2b-256 |
28bc1e518f1dd485e35a042756199be91c3c3b9659012e69a88422bb8371fccf
|
File details
Details for the file tgconvertor-0.1.4-py3-none-any.whl.
File metadata
- Download URL: tgconvertor-0.1.4-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c8eca67286496fdcc32cfee8fd42b278b75b7e53a4c70e244ecd47c246f6146
|
|
| MD5 |
cbc077f1f575b52551682c6ab69856d8
|
|
| BLAKE2b-256 |
34e8442021dc197d592e59eeafc88334034f53b2b454dd3bfe0e1ff2ec576cd6
|