Export Telegram Stories viewers and build analytics reports.
Project description
Telegram Stories Analytics
tg-stories exports your own Telegram Stories through Telethon, fetches viewer
lists, computes engagement analytics, and renders local JSON, Markdown, and
HTML reports.
The CLI is packaged as a normal Python console script and works on macOS,
Linux, and Windows. Authentication is stored in the system keyring. On macOS it
can also reuse credentials created by the local telegram-telethon skill.
Install
For normal use:
pipx install telegram-stories-analytics
For local development:
python -m venv .venv
source .venv/bin/activate
python -m pip install -e .
Telegram API Credentials
Create api_id and api_hash at https://my.telegram.org under API
Development Tools.
Then login once:
tg-stories auth login --profile personal
Check the session:
tg-stories auth status --profile personal
On macOS, if you already use the telegram-telethon skill, this tool can reuse
that Keychain session:
tg-stories auth status --profile ivanopcode --auth-source telegram-telethon
Export Stories
Full export:
tg-stories export --profile personal --progress --open
This writes:
exports/my-telegram-stories-full.json
exports/my-telegram-stories-analysis.json
exports/my-telegram-stories-analysis.md
exports/my-telegram-stories-analysis.html
The full JSON contains each story, Telegram story link when available, metadata,
counts, and a nested viewers array with viewer identity, view date, and
reaction.
Rebuild Reports
If you already have a full export, recompute analytics without calling Telegram:
tg-stories analyze exports/my-telegram-stories-full.json --open
Render or open HTML from an analysis JSON:
tg-stories html exports/my-telegram-stories-analysis.json --open
tg-stories open exports/my-telegram-stories-analysis.json
Analytics
The generated analysis includes:
- all-time regularity and
>=80%viewers; - recent windows, by default 30, 90, and 180 days;
- sliding-window regularity;
- fastest regular viewers by median view latency;
- story-level speed buckets: 5m, 15m, 1h, 6h, and 24h;
- top viewers by absolute reactions;
- top viewers by reaction rate;
- lapsed viewers, new recent viewers, and declining viewers;
- contact, mutual contact, non-contact, and premium segments.
Important definitions:
view_rate = viewed_story_count / story_countreaction_rate_per_viewed_story = reaction_count / viewed_story_countview_latency_seconds = viewer view_date - story date
Environment Auth
For CI-like or temporary usage, credentials can be provided through environment variables:
export TG_STORIES_API_ID=12345
export TG_STORIES_API_HASH=...
export TG_STORIES_SESSION=...
tg-stories export --auth-source env
Do not commit exported reports. Viewer data is personal data.
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 telegram_stories_analytics-0.1.0.tar.gz.
File metadata
- Download URL: telegram_stories_analytics-0.1.0.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
976229db3e397210070c8d646171548d7061d6ee4e3814359e3c23364b717f3e
|
|
| MD5 |
6c6c9d4af48a55377b0c46c4762745ca
|
|
| BLAKE2b-256 |
323878d366ea0d82cbc25364593033b02c842e85bceea3be8cfa724e25225a69
|
Provenance
The following attestation bundles were made for telegram_stories_analytics-0.1.0.tar.gz:
Publisher:
publish.yml on ivanopcode/telegram-stories-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telegram_stories_analytics-0.1.0.tar.gz -
Subject digest:
976229db3e397210070c8d646171548d7061d6ee4e3814359e3c23364b717f3e - Sigstore transparency entry: 1850965775
- Sigstore integration time:
-
Permalink:
ivanopcode/telegram-stories-analytics@6e88849139b1ecf40c689be93ce64086e9a760d9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ivanopcode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6e88849139b1ecf40c689be93ce64086e9a760d9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file telegram_stories_analytics-0.1.0-py3-none-any.whl.
File metadata
- Download URL: telegram_stories_analytics-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfab138621b527baf75438348d3a4cd89339db54e15b45f1e1427b2795b50115
|
|
| MD5 |
855626e2b08b06b69b29d6c6f161ec11
|
|
| BLAKE2b-256 |
36806986b1f1d864aa4f541fa4c65f6fa2052fe771ea7b931977647c1bf05550
|
Provenance
The following attestation bundles were made for telegram_stories_analytics-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ivanopcode/telegram-stories-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telegram_stories_analytics-0.1.0-py3-none-any.whl -
Subject digest:
bfab138621b527baf75438348d3a4cd89339db54e15b45f1e1427b2795b50115 - Sigstore transparency entry: 1850965974
- Sigstore integration time:
-
Permalink:
ivanopcode/telegram-stories-analytics@6e88849139b1ecf40c689be93ce64086e9a760d9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ivanopcode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6e88849139b1ecf40c689be93ce64086e9a760d9 -
Trigger Event:
release
-
Statement type: