{"id":23410770,"url":"https://github.com/werserk/telegram_group_stats","last_synced_at":"2026-04-30T03:41:34.244Z","repository":{"id":269292771,"uuid":"891143214","full_name":"werserk/telegram_group_stats","owner":"werserk","description":"Find the most closest to you users of large group by count of common groups.","archived":false,"fork":false,"pushed_at":"2024-12-23T01:10:43.000Z","size":756,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-15T20:44:50.224Z","etag":null,"topics":["streamlit","tdlib","telegram"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/werserk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-11-19T20:00:26.000Z","updated_at":"2025-01-03T21:52:34.000Z","dependencies_parsed_at":"2024-12-25T08:03:36.490Z","dependency_job_id":null,"html_url":"https://github.com/werserk/telegram_group_stats","commit_stats":null,"previous_names":["werserk/telegram_group_stats"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/werserk/telegram_group_stats","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werserk%2Ftelegram_group_stats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werserk%2Ftelegram_group_stats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werserk%2Ftelegram_group_stats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werserk%2Ftelegram_group_stats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/werserk","download_url":"https://codeload.github.com/werserk/telegram_group_stats/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werserk%2Ftelegram_group_stats/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32454157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["streamlit","tdlib","telegram"],"created_at":"2024-12-22T17:51:27.997Z","updated_at":"2026-04-30T03:41:34.218Z","avatar_url":"https://github.com/werserk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Telegram Group Stats](assets/images/telegram.png)\n\n# Telegram Group Stats\n\n![Project Logo](assets/images/img.png)\n![Analytics Screenshot](assets/images/img_1.png)\n\n**Telegram Group Stats** is a powerful tool designed to extract and analyze information from your Telegram groups using TDLib (Telegram Database Library). It offers comprehensive insights into user memberships, common groups among users, and visual analytics through an intuitive Streamlit interface.\n\n## Table of Contents\n\n- [Features](#features)\n- [Demo](#demo)\n- [Installation](#installation)\n  - [Prerequisites](#prerequisites)\n  - [Setup TDLib](#setup-tdlib)\n  - [Environment Configuration](#environment-configuration)\n  - [Docker Setup](#docker-setup)\n- [Usage](#usage)\n- [Testing](#testing)\n- [Development](#development)\n- [License](#license)\n- [Contact](#contact)\n\n## Features\n\n- **Telegram Integration:** Seamlessly connect and authorize your Telegram account using TDLib.\n- **Group Management:** Fetch and display all your Telegram groups, including supergroups and channels.\n- **Member Analysis:** Retrieve detailed member lists from selected groups.\n- **Common Groups Analysis:** Identify and count the number of groups shared between users.\n- **Interactive Analytics:** Visualize data through interactive graphs and detailed statistics using Streamlit.\n- **Comprehensive Testing:** Ensure reliability with a suite of unit tests.\n- **Docker Support:** Easy deployment using Docker and Docker Compose.\n- **Extensible Architecture:** Modular design allowing for future enhancements and feature additions.\n\n## Demo\n\nCheck out our [Video Demo](https://drive.google.com/file/d/1bnfRz6lTo-szwSJitRH16emSjPoy-fiH/view?usp=sharing) to see Telegram Group Stats in action.\n\n## Installation\n\n### Prerequisites\n\n- **Operating System:** Linux-based system recommended.\n- **Dependencies:**\n  - `cmake`, `g++`, `zlib1g-dev`, `libssl-dev`, `gperf`, `make`, `git`\n  - **Python:** Version 3.11+\n  - **Poetry:** For dependency management\n- **Docker:** (Optional, for containerized setup)\n\n### Setup TDLib\n\n1. **Install Build Dependencies:**\n\n    ```bash\n    sudo apt-get update \u0026\u0026 sudo apt-get upgrade -y\n    sudo apt-get install -y make git zlib1g-dev libssl-dev gperf cmake g++\n    ```\n\n2. **Clone and Build TDLib:**\n\n    ```bash\n    git clone https://github.com/tdlib/td.git\n    cd td\n    mkdir build \u0026\u0026 cd build\n    cmake -DCMAKE_BUILD_TYPE=Release ..\n    cmake --build .\n    cd ../../\n    cp ./td/build/libtdjson.so.1.8.40 ./libtdjson.so\n    ```\n\n### Environment Configuration\n\n1. **Clone the Repository:**\n\n    ```bash\n    git clone https://github.com/werserk/telegram_group_stats.git\n    cd telegram_group_stats\n    ```\n\n2. **Set Up Environment Variables:**\n\n    Copy the example environment file and fill in your `API_ID` and `API_HASH`:\n\n    ```bash\n    cp example.env .env\n    ```\n\n    Edit the `.env` file:\n\n    ```env\n    API_ID=your_api_id_here\n    API_HASH=your_api_hash_here\n    DATABASE_DIR=tdlib\n    TDLIB_LOGGING_LEVEL=2\n    ```\n\n### Docker Setup\n\n1. **Build and Run with Docker Compose:**\n\n    Ensure Docker and Docker Compose are installed on your system.\n\n    ```bash\n    docker-compose up --build\n    ```\n\n2. **Access the Application:**\n\n    Open your browser and navigate to [http://localhost:8501](http://localhost:8501) to interact with the Streamlit app.\n\n## Usage\n\n1. **Authorization:**\n\n    - Navigate to the **Authorization** page via the sidebar.\n    - Enter your Telegram phone number and follow the prompts to authorize the application.\n\n2. **Analytics:**\n\n    - Once authorized, switch to the **Analytics** page.\n    - Select a group chat to analyze its members.\n    - Click on **Analyze chat** to generate statistics.\n    - View detailed member information and interactive graphs visualizing group relationships.\n\n## Testing\n\nEnsure the application functions correctly by running the provided test suite.\n\n1. **Install Dependencies:**\n\n    ```bash\n    poetry install\n    ```\n\n2. **Run Tests:**\n\n    ```bash\n    pytest\n    ```\n\n    The tests cover authentication flows, service interactions, and analytics functionalities to ensure robustness.\n\n### Test Cases\n\nKey test cases implemented include:\n\n- **test_auth_page_shows_phone_input:** Verifies that the phone input is displayed during the phone number authorization step.\n- **test_auth_page_no_auth_state:** Ensures that a success message is shown when the authorization state is READY.\n- **test_get_my_user_id:** Confirms that the service correctly retrieves the current user's ID.\n- **test_get_chats_empty:** Checks that `get_chats` returns an empty list when there are no chats.\n- **test_get_chats_success:** Validates that `get_chats` successfully fetches and lists group chats.\n- **test_get_chat_members_basic:** Tests that `get_chat_members` retrieves members from a basic group correctly.\n- **test_set_verbosity_level:** Ensures that the verbosity level is set correctly.\n- **test_set_verbosity_level_multiple_calls:** Checks that multiple verbosity level settings are handled properly.\n- **test_is_authorized:** Verifies that `is_authorized` returns True when authorized.\n- **test_send:** Confirms that the `send` method transmits the correct data.\n- **test_receive:** Validates that the `receive` method retrieves the expected data.\n- **test_execute:** Tests that the `execute` method sends a query and returns the correct response.\n- **test_login_step_changes_state:** Ensures that `login_step` updates the authorization state appropriately.\n- **test_login_step_no_state_change:** Confirms that `login_step` does not change state when there are no updates.\n- **test_analytics_page_show_chats:** Verifies that `AnalyticsPage.show` displays chats and populates statistics.\n\n## Development\n\n### Prerequisites\n\n- **Operating System:** Linux-based system\n- **Tools:** `cmake`, `g++`, `zlib1g-dev`, `libssl-dev`, `gperf`, `make`, `git`\n- **Python:** Version 3.11+\n- **Poetry:** For dependency management\n\n### Setting Up the Development Environment\n\n1. **Clone the Repository:**\n\n    ```bash\n    git clone https://github.com/werserk/telegram_group_stats.git\n    cd telegram_group_stats\n    ```\n\n2. **Set Up Poetry Environment:**\n\n    ```bash\n    poetry install\n    poetry shell\n    ```\n\n3. **Build TDLib (if not already done):**\n\n    Follow the [Setup TDLib](#setup-tdlib) instructions above.\n\n### Code Structure\n\n```\n.\n├── app\n│ ├── init.py\n│ ├── constants.py\n│ ├── telegram\n│ │ ├── init.py\n│ │ ├── client.py\n│ │ ├── functional.py\n│ │ └── service.py\n│ └── web\n│   ├── init.py\n│   ├── analytics.py\n│   ├── auth.py\n│   └── graph.py\n├── assets\n│ └── images\n│   ├── telegram.png\n│   ├── img.png\n│   └── img_1.png\n├── docker-compose.yaml\n├── Dockerfile\n├── example.env\n├── libtdjson.so\n├── main.py\n├── poetry.lock\n├── pyproject.toml\n├── README.md\n└── tests\n  ├── __init__.py\n  ├── conftest.py\n  ├── test_analytics.py\n  ├── test_auth.py\n  ├── test_client.py\n  └── test_service.py\n```\n\n### Linters and Code Quality\n\nMaintain code quality using the following tools:\n\n- **Black:** Code formatter\n- **Flake8:** Linting\n- **isort:** Import sorter\n- **Mypy:** Type checker\n\nRefer to `pyproject.toml` for configuration details.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Contact\n\n- **GitHub:** [https://github.com/werserk/telegram_group_stats](https://github.com/werserk/telegram_group_stats)\n- **Telegram:** [@werserk](https://t.me/werserk)\n\n---\n*Made with ❤️ by [werserk](https://github.com/werserk)*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwerserk%2Ftelegram_group_stats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwerserk%2Ftelegram_group_stats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwerserk%2Ftelegram_group_stats/lists"}