{"id":27624387,"url":"https://github.com/eyaadh/iptv-stream-checker","last_synced_at":"2026-02-22T18:36:42.632Z","repository":{"id":289042714,"uuid":"969929497","full_name":"eyaadh/IPTV-Stream-Checker","owner":"eyaadh","description":"This Python script monitors a list of UDP streams (unicast or multicast) and sends a Telegram notification if any streams are inactive or unreachable.","archived":false,"fork":false,"pushed_at":"2025-04-21T07:17:03.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-21T08:29:24.117Z","etag":null,"topics":["monitoring","multicast","python3","requests","socket","telegram","udp"],"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/eyaadh.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":"2025-04-21T07:00:02.000Z","updated_at":"2025-04-21T08:27:56.000Z","dependencies_parsed_at":"2025-04-21T08:40:28.843Z","dependency_job_id":null,"html_url":"https://github.com/eyaadh/IPTV-Stream-Checker","commit_stats":null,"previous_names":["eyaadh/iptv-stream-checker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyaadh%2FIPTV-Stream-Checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyaadh%2FIPTV-Stream-Checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyaadh%2FIPTV-Stream-Checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyaadh%2FIPTV-Stream-Checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eyaadh","download_url":"https://codeload.github.com/eyaadh/IPTV-Stream-Checker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250428773,"owners_count":21429187,"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":["monitoring","multicast","python3","requests","socket","telegram","udp"],"created_at":"2025-04-23T11:38:38.677Z","updated_at":"2026-02-22T18:36:42.578Z","avatar_url":"https://github.com/eyaadh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔍 IPTV UDP Stream Checker with Telegram Alerts\n\nThis Python script monitors a list of UDP streams (unicast or multicast) and sends a Telegram alert if any stream becomes inactive or unreachable.\n\nPerfect for IPTV providers, network admins, or anyone relying on uninterrupted UDP stream delivery.\n\n---\n\n## 🚀 Features\n\n- ✅ Supports both multicast and unicast UDP streams.\n- ✅ Retries failed stream checks before declaring them down.\n- ✅ Optional requirement for receiving actual data (for more accurate checks).\n- ✅ Sends real-time alerts to Telegram when streams go down.\n- ✅ Uses a scheduler to run periodic checks (default: **every 1 hour**).\n- ✅ Detailed logs for monitoring, alerts, and debugging.\n\n---\n\n## 📦 Requirements\n\n- Python 3.6+\n- Install dependencies using:\n\n```bash\npip install -r requirements.txt\n```\n\nContents of `requirements.txt`:\n```txt\nrequests==2.32.3\napscheduler==3.10.4\n```\n\n---\n\n## ⚙️ Configuration\n\nCreate a file named `config.json` in the same directory:\n\n```json\n{\n  \"telegram\": {\n    \"bot_token\": \"your_telegram_bot_token_here\",\n    \"chat_id\": \"your_telegram_chat_id_here\"\n  },\n  \"streams\": {\n    \"udp\": [\n      {\n        \"name\": \"Channel 1\",\n        \"url\": \"udp://239.1.1.1:1234\"\n      },\n      {\n        \"name\": \"Channel 2\",\n        \"url\": \"udp://239.1.1.2:5678\"\n      }\n    ]\n  }\n}\n```\n\n- Replace `bot_token` and `chat_id` with your Telegram bot credentials.\n- Add as many UDP streams as needed, each with a descriptive `name` and valid `url`.\n\n---\n\n## 📡 How It Works\n\n1. Loads UDP streams and Telegram bot settings from `config.json`.\n2. Parses each stream's address and checks for availability.\n3. If multicast, joins the group before checking.\n4. Optionally listens for real UDP traffic (`require_data=True`).\n5. Retries failed streams before marking them as down.\n6. Sends a Telegram alert if any streams are unreachable.\n\n---\n\n## 🛠️ Usage\n\nRun the script with:\n\n```bash\npython main.py\n```\n\nWhat it does:\n- Immediately runs a stream check.\n- Starts a background scheduler that checks **every hour**.\n- Keeps running until terminated manually.\n\n---\n\n## 🔄 Customization\n\nYou can adjust the stream-check behavior by modifying the parameters inside the `scheduled_task()` function:\n\n```python\ncheck_channels(\n    udp_streams,\n    timeout=10,             # Timeout per attempt (in seconds)\n    retry_attempts=2,       # Number of retries before failure\n    retry_delay=2,          # Delay between retries (in seconds)\n    require_data=True       # Set to True to require actual packet reception\n)\n```\n\n---\n\n## 📬 Telegram Bot Setup\n\n1. Message [@BotFather](https://t.me/BotFather)\n2. Create a new bot: `/newbot`\n3. Copy the generated `bot_token`\n4. To find your chat ID:\n   - Start a conversation with your bot.\n   - Visit:  \n     ```\n     https://api.telegram.org/bot\u003cyour_bot_token\u003e/getUpdates\n     ```\n   - Look for `\"chat\":{\"id\":...}` in the JSON response.\n\n---\n\n## 📝 Example Telegram Alert\n\n```\n🚨 IPTV Stream Alert 🚨\nThe following channels are DOWN:\n- Channel 1: No response or timeout\n- Channel 2: Invalid URL\n```\n\n---\n\n## 📄 License\n\nMIT License — free to use, modify, and distribute.\n\n---\n\n## 👨‍💻 Author\n\nBuilt with ❤️ by **eyaadh**  \n📧 Email: eyaadh@eyaadh.net  \n💬 Telegram: [@eyaadh](https://t.me/eyaadh)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyaadh%2Fiptv-stream-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feyaadh%2Fiptv-stream-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyaadh%2Fiptv-stream-checker/lists"}