Skip to main content

Channels Cleaner

CI PyPI License: MIT

Go through every Telegram channel you're subscribed to, one card at a time, and get rid of the ones you stopped reading years ago. Swipe left to leave, right to keep, or mute and archive. Nothing changes in Telegram until you've reviewed the whole batch.

It runs on your own computer: a small Python server (a Kurigram userbot + FastAPI) and a web UI that opens in your browser. No hosted service, no accounts.

Swiping through channels in mock mode

What it does

  • One card per channel, with the numbers that matter: posts per week (or how long it's been silent), a 26-week activity chart, subscribers, unread count and a preview of the last post. The card takes its colour from the channel's avatar.
  • Five verdicts: unsubscribe, keep, mute, archive or "later" (back of the deck). Swipe the card, click either side of it or use the keyboard.
  • Two orders: dead channels first (never posted, then longest silence) or most unread first, each reversible.
  • The progress bar is your history. Every decision lands in it in order, coloured by verdict. Hover it to see a magnified strip of avatars, click to go back to any decision and change it, or step through them with Ctrl+←/→.
  • Nothing happens until you confirm. Unsubscribe, mute and archive are queued. The review screen groups them, flags private channels you can't rejoin without an invite, then applies them one by one with pauses, handling Telegram's flood waits.
  • Changed your mind later? Turn an applied mute or archive into "keep" and the next run unmutes or unarchives the channel.
  • Results and export: what's left of your subscriptions by last post, plus a CSV/JSON list of what you left, with t.me links for the public ones.
  • QR or phone login with two-step verification, English and Russian, dark and light themes.
Deck (light theme) History loupe
The deck in the light theme Magnified history over the progress bar
Review Applying
Review screen grouping the queued actions Actions being applied one by one

Quick start

You need Python 3.12+ and either uv or pipx. The package includes the built UI, so no Node.js is required.

uvx telegram-channels-cleaner

or install it once and run it whenever you like:

pipx install telegram-channels-cleaner
telegram-channels-cleaner

A browser tab opens at http://127.0.0.1:8765. On your phone, open Telegram → Settings → Devices → Link Desktop Device and scan the QR code. You can also log in with a phone number and code; a two-step verification password is asked for when it's set.

Try it without a Telegram account

Mock mode replaces Telegram with 120 generated channels:

uvx telegram-channels-cleaner --mock

The QR code "scans" itself after a few seconds. The phone code is 12345; with CC_MOCK_2FA=1 the 2FA password is mock. The screenshots above are from mock mode.

Docker

docker run --rm -p 127.0.0.1:8765:8765 -v telegram-channels-cleaner:/data \
  ghcr.io/asteroid-den/telegram-channels-cleaner:latest

Then open http://127.0.0.1:8765. Or from a checkout: docker compose up -d. Keep the 127.0.0.1: part of the port mapping: the UI has no password, and whoever can open it can act on your Telegram account.

From source

git clone https://github.com/asteroid-den/telegram-channels-cleaner.git
cd telegram-channels-cleaner
npm --prefix frontend ci && npm --prefix frontend run build   # Node.js 22.18+
uv run telegram-channels-cleaner

Keyboard

Key Action
← / → Unsubscribe / keep
↓ Later: move to the back of the deck
M / A Mute / archive
Ctrl+Z or Backspace Undo the last decision
Ctrl+← / → Step back / forward through decisions you've made
Enter Go to the review
Ctrl+Enter Apply (on the review screen)
Esc Back to the deck

Letter keys work on any keyboard layout. On macOS, Cmd works in place of Ctrl.

Privacy and safety

Read this before logging in with your real account.

  • The session file is your Telegram account. Anyone who copies it can read your messages and act as you, without your password or 2FA. It lives in the data directory below, which the app keeps readable only by your user (on Linux and macOS). Don't sync it to the cloud, don't share it.
  • Everything stays on your machine. The server listens on 127.0.0.1 only, talks to Telegram directly and nowhere else. There is no telemetry.
  • The UI has no password, because it's meant for one person on their own computer. Don't expose it to a network (--host 0.0.0.0) you don't fully control.
  • Log out and delete local data in the account menu ends the session on Telegram's side and wipes everything stored for that account. Ending the session from Telegram (Settings → Devices) also works; delete the data directory afterwards.

Where the data lives

How you run it Location
uvx / pipx on Linux ~/.local/share/telegram-channels-cleaner (or $XDG_DATA_HOME)
uvx / pipx on macOS ~/Library/Application Support/telegram-channels-cleaner
uvx / pipx on Windows %APPDATA%\telegram-channels-cleaner
From source ./data in the checkout
Docker the /data volume

The startup message prints the exact path. Inside:

  • sessions/account.session: the Telegram session.
  • sessions/account.device.json: the device profile this session presents to Telegram.
  • cleaner.sqlite3: the channel cache, your decisions and stats.
  • media/: cached avatars and post thumbnails.

About the API id and the device profile

Telegram identifies third-party clients by an api_id. Out of the box this app uses the public api_id of Telegram Desktop and, on first login, picks a plausible Telegram Desktop device profile (OS, app version, language) from device_profiles.json. The profile is stored with the session and never changes after that, so in Settings → Devices you'll see one ordinary desktop session rather than a new device on every start.

To be clear about what that means: the app presents itself as Telegram Desktop. Using an unofficial client is at your own risk under Telegram's Terms of Service, and Telegram can limit accounts it considers abusive. For a cleaner setup, register your own app at https://my.telegram.org/apps and set CC_API_ID and CC_API_HASH.

Pace

Reading is cheap: channel details and the last 100 post dates are fetched lazily, one card at a time, and cached for 72 hours. Actions run one after another with a random 1.5–3 s pause. If Telegram replies with a flood wait, the job sleeps for the time it was told to (the UI shows a countdown) and carries on. You can stop the job at any point; whatever wasn't applied stays queued. Channels you own or administer are never shown.

Configuration

Everything is optional. Use environment variables or a .env file in the working directory (see .env.example).

CLI flag Env var Default
--host CC_HOST 127.0.0.1 Address to listen on
--port CC_PORT 8765 Port
--no-browser CC_NO_BROWSER=1 off Don't open a browser tab
--mock CC_MOCK=1 off Fake Telegram backend
CC_MOCK_CHANNELS 120 Number of generated channels
CC_MOCK_2FA=1 off Ask for a 2FA password in mock mode
CC_DATA_DIR see above Sessions, database, media cache
CC_API_ID, CC_API_HASH Telegram Desktop Your own Telegram API credentials
CC_APPLY_DELAY_MIN, CC_APPLY_DELAY_MAX 1.5, 3.0 Pause between actions, seconds
CC_FULL_INFO_TTL_HOURS 72 How long channel details stay cached
-v off Debug logging

Development

uv sync
npm --prefix frontend ci

uv run telegram-channels-cleaner --mock --dev   # API only, on :8765
npm --prefix frontend run dev          # UI with hot reload on :5173, proxies /api

Checks, the same as CI:

uv run ruff check && uv run ruff format --check && uv run pyright && uv run pytest
cd frontend && npm run lint && npm run format:check && npm run test && npm run build
src/channels_cleaner/
  telegram/    gateway protocol; Kurigram and mock implementations; device profiles
  services/    auth state machine, sync, lazy channel info + activity, apply job, stats
  api/         FastAPI routes: REST + Server-Sent Events
  db.py        SQLite schema, migrations and queries
frontend/src/  Vue 3 + Vite + TypeScript, Pinia, vue-i18n, Tailwind
  stores/      auth, deck (queue, history, rewind), apply, ui
  views/       Login, Deck, Review, Apply, Results
  components/  swipe deck, channel card, progress bar + loupe, summary pill…

Releasing

Push a v* tag matching __version__ in src/channels_cleaner/__init__.py. The release workflow builds the wheel with the UI, publishes it to PyPI through trusted publishing and pushes a multi-arch image to GHCR. One-time setup: on pypi.org, add a pending trusted publisher for project telegram-channels-cleaner with workflow release.yml and environment pypi, and create an environment named pypi in the repository settings.

License

MIT

Metadata

Release files for telegram-channels-cleaner 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for telegram-channels-cleaner 1.0.2
File Size Uploaded Provenance Actions
telegram_channels_cleaner-1.0.2.tar.gz 452.3 kB With provenance Details for telegram_channels_cleaner-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for telegram-channels-cleaner 1.0.2
File Interpreter ABI Platform Actions
telegram_channels_cleaner-1.0.2-py3-none-any.whl Python 3 none any Details for telegram_channels_cleaner-1.0.2-py3-none-any.whl

Total release size: 917.1 kB

Release files / telegram_channels_cleaner-1.0.2.tar.gz

Download URL telegram_channels_cleaner-1.0.2.tar.gz
Size 452.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d301c697103c19bb39f6fee9f62a6c4b00206f197da2089f5cf045e5df30ee28
BLAKE2b-256 checksum
How to use checksums
8b7864f5fc9290384c0b5d14be39cb5dcb23eff432bb4c081745ddae189f9636
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / telegram_channels_cleaner-1.0.2-py3-none-any.whl

Download URL telegram_channels_cleaner-1.0.2-py3-none-any.whl
Size 464.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b312c410523effd4d8cbb816f72f649c8457f9cb9dead67ed6d3ebb8aae4e12
BLAKE2b-256 checksum
How to use checksums
5e2e117f1a932e6c19caca7e44ead31881913907631a558dd07a919303372d38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for telegram-channels-cleaner 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for telegram_channels_cleaner-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page