{"id":27774257,"url":"https://github.com/axljung/telegram-media-sync","last_synced_at":"2026-02-26T16:02:14.357Z","repository":{"id":290391500,"uuid":"974299815","full_name":"axljung/telegram-media-sync","owner":"axljung","description":"Just a python CLI tool to download all media from a Telegram channel","archived":false,"fork":false,"pushed_at":"2025-04-28T15:06:39.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T02:04:47.824Z","etag":null,"topics":["python-script","python3","telegram"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/axljung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-28T15:02:35.000Z","updated_at":"2025-04-28T15:07:49.000Z","dependencies_parsed_at":"2025-04-28T16:37:26.118Z","dependency_job_id":null,"html_url":"https://github.com/axljung/telegram-media-sync","commit_stats":null,"previous_names":["axljung/telegram-media-sync"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/axljung/telegram-media-sync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axljung%2Ftelegram-media-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axljung%2Ftelegram-media-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axljung%2Ftelegram-media-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axljung%2Ftelegram-media-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axljung","download_url":"https://codeload.github.com/axljung/telegram-media-sync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axljung%2Ftelegram-media-sync/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265241154,"owners_count":23733188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python-script","python3","telegram"],"created_at":"2025-04-30T02:04:46.216Z","updated_at":"2026-02-26T16:02:09.331Z","avatar_url":"https://github.com/axljung.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telegram Media Sync\n\nA Python CLI tool to download all new media from a Telegram chat or channel, with persistent authentication, per-channel folders, and an interactive selection menu.\n\n## Features\n\n- **Interactive Selection**: Choose from all your chats and channels via a nice CLI menu powered by `questionary`.\n- **Persistent Session**: Login once; session data is saved so you don't need to re-authenticate every run.\n- **Per-Channel Storage**: Media are organized into subdirectories named by channel ID.\n- **Sync Mode**: Skips already-downloaded files to avoid duplicates.\n\n## Prerequisites\n\n- Python 3.8 or higher\n- A Telegram API ID and API Hash (obtain from https://my.telegram.org)\n\n## Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/axljung/telegram-media-sync.git\ncd telegram-media-sync\n\n# Create and activate a virtual environment (Unix/macOS)\npython3 -m venv venv\nsource venv/bin/activate\n\n# Windows PowerShell\nenv\\Scripts\\Activate.ps1\n\n# Install required Python packages\npip install telethon questionary\n```\n\n\u003e Optionally, you can save dependencies to a `requirements.txt`:\n\u003e\n\u003e ```bash\n\u003e pip freeze \u003e requirements.txt\n\u003e ```\n\n## Usage\n\n```bash\n# Interactive mode: list chats and choose one\npython telegram_media_sync.py \\\n  --api-id YOUR_API_ID \\\n  --api-hash YOUR_API_HASH \\\n  --list-chats \\\n  --output-dir ./downloads \\\n  --session media_session\n\n# Direct mode: specify channel by username or ID\npython telegram_media_sync.py \\\n  --api-id YOUR_API_ID \\\n  --api-hash YOUR_API_HASH \\\n  --channel my_channel_username \\\n  --output-dir ./downloads \\\n  --session media_session \\\n  --limit 500\n```\n\n### Command-line Arguments\n\n| Argument      | Type    | Required | Default         | Description                                        |\n|---------------|---------|----------|-----------------|----------------------------------------------------|\n| `--api-id`    | int     | yes      |                 | Your Telegram API ID                               |\n| `--api-hash`  | string  | yes      |                 | Your Telegram API Hash                             |\n| `--session`   | string  | no       | `media_sync`    | Name for the Telethon session file                 |\n| `--list-chats`| flag    | no       |                 | If set, displays an interactive menu of dialogs    |\n| `--channel`   | string  | no       |                 | Channel username or numeric ID (e.g. `-100123456...`)|\n| `--output-dir`| string  | no       | `downloads`     | Base directory where media will be stored          |\n| `--limit`     | int     | no       | all messages    | Maximum number of messages to scan                 |\n\n\u003e **Note:** Either `--list-chats` or `--channel` must be provided.\n\n## First Run\n\nOn the first invocation, Telethon will prompt for your phone number and an authentication code sent by Telegram. Once verified, a session file (`\u003csession\u003e.session`) is created, and subsequent runs will use it.\n\n## Folder Structure\n\n```\ndownloads/            # base output directory\n└── \u003cchannel_id\u003e/     # one folder per channel\n    ├── .downloaded_ids.txt  # recorded message IDs\n    ├── 12345.jpg            # downloaded media files\n    └── 67890.mp4\n```\n\n## License\n\nThis project is released under the MIT License. Feel free to use and adapt it as you like.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxljung%2Ftelegram-media-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxljung%2Ftelegram-media-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxljung%2Ftelegram-media-sync/lists"}