Metadata-Version: 2.4
Name: tgconvertor
Version: 0.0.9
Summary: This module is small util for easy converting Telegram sessions to various formats.
Author-email: Назар <nazar.fedorowych@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/nazar220160/TGConvertor
Project-URL: Repository, https://github.com/nazar220160/TGConvertor.git
Project-URL: Issues, https://github.com/nazar220160/TGConvertor/issues
Project-URL: Changelog, https://github.com/nazar220160/TGConvertor/releases
Keywords: telegram,session,converter,telethon,pyrogram
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Communications :: Chat
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.9.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typing-extensions>=4.0.0
Requires-Dist: opentele
Requires-Dist: aiosqlite
Requires-Dist: pyrogram
Dynamic: license-file

<img src="https://cdn4.iconfinder.com/data/icons/social-media-and-logos-12/32/Logo_telegram_Airplane_Air_plane_paper_airplane-33-256.png" align="right" width="131" />

# TGConvertor

![PyPI](https://img.shields.io/pypi/v/TGSessionsConverter)
![PyPI - License](https://img.shields.io/pypi/l/TGSessionsConverter)

This module is small util for easy converting Telegram sessions to various formats (Telethon, Pyrogram, Tdata)
<hr/>

## Installation

```
$ pip install TGConvertor
```

## Using CLI

After installation, you can use the `tgconvertor` command-line tool:

```bash
# 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:

```bash
# 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:

```bash
# 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 client
- `ios`: Telegram iOS client
- `macos`: Telegram macOS client
- `web`: Telegram Web client

## Quickstart (Python API)

```python
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`
