{"id":49609121,"url":"https://github.com/detekoi/live-notify","last_synced_at":"2026-05-04T15:07:02.880Z","repository":{"id":281576816,"uuid":"945625569","full_name":"detekoi/live-notify","owner":"detekoi","description":"Monitors Twitch streams and notifies a Discord channel when it goes live, changes games, or hits viewer milestones.","archived":false,"fork":false,"pushed_at":"2025-05-11T20:51:00.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-11T21:26:59.462Z","etag":null,"topics":["discord","discord-bot","discord-webhook","notification-bot","python","streaming","streaming-tools","twitch","twitch-api","twitch-notifications","twitch-notifications-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/detekoi.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}},"created_at":"2025-03-09T21:05:18.000Z","updated_at":"2025-05-11T20:51:03.000Z","dependencies_parsed_at":"2025-03-10T13:15:27.850Z","dependency_job_id":null,"html_url":"https://github.com/detekoi/live-notify","commit_stats":null,"previous_names":["detekoi/live-notify"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/detekoi/live-notify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detekoi%2Flive-notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detekoi%2Flive-notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detekoi%2Flive-notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detekoi%2Flive-notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/detekoi","download_url":"https://codeload.github.com/detekoi/live-notify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detekoi%2Flive-notify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32612409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["discord","discord-bot","discord-webhook","notification-bot","python","streaming","streaming-tools","twitch","twitch-api","twitch-notifications","twitch-notifications-bot"],"created_at":"2026-05-04T15:06:59.101Z","updated_at":"2026-05-04T15:07:02.874Z","avatar_url":"https://github.com/detekoi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Live Notify for Twitch and Discord\n\nA Python script that polls the Twitch API to detect when a channel goes live and sends customized notifications to a Discord webhook.\n\n## Features\n\n- Automatic notifications when a stream goes live\n- Customizable Discord embed notifications\n- Game change notifications\n- Viewer milestone notifications (e.g., when reaching 50, 100, 500 viewers)\n- Configurable polling intervals\n- Test notification mode\n- State persistence between runs\n- Robust error handling with retry logic\n- Network connectivity checking\n- Watchdog service to auto-restart on failures\n- **Bluesky \"Live Now\" Badge Integration**\n\n\n## Setup\n\n1. Install the required dependencies:\n   ```\n   pip install -r requirements.txt\n   ```\n\n2. Configure your settings using either environment variables or a config file:\n\n   **Option 1 (Recommended for Security): Using Environment Variables**\n   \n   You can set the essential environment variables directly in your terminal or create a `.env` file in the project directory:\n   \n   ```\n   TWITCH_CLIENT_ID=your_client_id\n   TWITCH_CLIENT_SECRET=your_client_secret\n   TWITCH_CHANNEL_NAME=channel_to_monitor\n   DISCORD_WEBHOOK_URL=your_webhook_url\n   BLUESKY_HANDLE=your_handle.bsky.social\n   BLUESKY_PASSWORD=your_app_password\n   ```\n   \n   **Option 2: Using Config File**\n   \n   If you prefer using a config file:\n   ```\n   cp config.template.json config.json\n   ```\n   \n   Then edit `config.json` with your favorite text editor and add your credentials.\n   \n   **IMPORTANT**: Never commit files with real credentials to public repositories\n\n3. Run the script:\n   ```\n   python twitch_discord_notifier.py\n   ```\n\n## Configuration\n\nYou can customize the notifier using environment variables (recommended) or a config file. Environment variables take precedence over the config file if both are present.\n\n### Environment Variables\n\nThe following environment variables are essential for using the application:\n\n**Required Settings:**\n```\nTWITCH_CLIENT_ID=your_client_id\nTWITCH_CLIENT_SECRET=your_client_secret\nTWITCH_CHANNEL_NAME=channel_to_monitor\nDISCORD_WEBHOOK_URL=your_webhook_url\nBLUESKY_HANDLE=your_handle.bsky.social\nBLUESKY_PASSWORD=your_app_password\n```\n\n**Optional Settings:**\n```\nNOTIFICATION_MESSAGE_TEMPLATE=🔴 **LIVE NOW!** {streamer} is streaming {game}\nNOTIFICATION_INCLUDE_TITLE=true\nNOTIFICATION_INCLUDE_GAME=true\nNOTIFICATION_INCLUDE_VIEWER_COUNT=true\nNOTIFICATION_INCLUDE_UPTIME=true\nNOTIFICATION_INCLUDE_THUMBNAIL=true\nNOTIFICATION_EMBED_COLOR=FF0000\nPOLLING_INTERVAL_SECONDS=60\nPOLLING_OFFLINE_CHECK_MULTIPLIER=3\nPOLLING_NOTIFICATION_COOLDOWN_MINUTES=15\nADVANCED_VIEWER_MILESTONE_NOTIFICATIONS=50,100,500,1000\nADVANCED_SILENT_MODE=false\nBLUESKY_ENABLED=true\nBLUESKY_DURATION=60\n```\n\n#### Making Environment Variables Permanent\n\nTo avoid setting environment variables each time you open a new terminal:\n\n* **Using .env file (Recommended)**:\n  Create a `.env` file in the project directory with your variables.\n\n* **macOS/Linux**:\n  Add to your `~/.zshrc` or `~/.bash_profile`:\n  ```\n  export TWITCH_CLIENT_ID=your_client_id\n  export TWITCH_CLIENT_SECRET=your_client_secret\n  export TWITCH_CHANNEL_NAME=channel_to_monitor\n  export DISCORD_WEBHOOK_URL=your_webhook_url\n  export BLUESKY_HANDLE=your_handle.bsky.social\n  export BLUESKY_PASSWORD=your_app_password\n  ```\n\n### Config File\n\nAlternatively, you can use a `config.json` file with this structure:\n\n```json\n{\n  \"twitch\": {\n    \"client_id\": \"YOUR_TWITCH_CLIENT_ID\",\n    \"client_secret\": \"YOUR_TWITCH_CLIENT_SECRET\",\n    \"channel_name\": \"CHANNEL_TO_MONITOR\"\n  },\n  \"discord\": {\n    \"webhook_url\": \"YOUR_DISCORD_WEBHOOK_URL\"\n  },\n  \"bluesky\": {\n    \"handle\": \"YOUR_BLUESKY_HANDLE\",\n    \"password\": \"YOUR_BLUESKY_APP_PASSWORD\",\n    \"enabled\": true,\n    \"duration_minutes\": 60\n  },\n  \"notification\": {\n    \"message_template\": \"🔴 **LIVE NOW!** {streamer} is streaming {game}\",\n    \"include_title\": true,\n    \"include_game\": true,\n    \"include_viewer_count\": true,\n    \"include_uptime\": true,\n    \"include_thumbnail\": true,\n    \"notify_on_game_change\": false,\n    \"embed_color\": \"FF0000\"\n  },\n  \"polling\": {\n    \"interval_seconds\": 60,\n    \"offline_check_multiplier\": 3,\n    \"notification_cooldown_minutes\": 15\n  },\n  \"advanced\": {\n    \"viewer_milestone_notifications\": [50, 100, 500, 1000],\n    \"silent_mode\": false\n  }\n}\n```\n\n## Command Line Options\n\n- `--config PATH`: Specify an alternative config file path\n- `--test`: Send a test notification\n- `--reset-state`: Reset stream state (force notification/live status update)\n- `--verbose`: Enable verbose logging\n- `--debug-api`: Print API request details for debugging\n\n## Using the Watchdog Service\n\nTo ensure the script keeps running even if it encounters errors, you can use the included watchdog service:\n\n1. Make the watchdog script executable:\n   ```\n   chmod +x watchdog.sh\n   ```\n\n2. Start the watchdog:\n   ```\n   ./watchdog.sh\n   ```\n\nThe watchdog will monitor the main script and restart it automatically if it crashes.\n\n## Setting Up as a System Service (macOS)\n\nFor a more permanent solution on macOS, you can set up the script as a LaunchAgent:\n\n1. Copy the provided plist file to your LaunchAgents directory:\n   ```\n   cp com.user.twitch-discord-notifier.plist ~/Library/LaunchAgents/\n   ```\n\n2. Load the LaunchAgent:\n   ```\n   launchctl load ~/Library/LaunchAgents/com.user.twitch-discord-notifier.plist\n   ```\n\nThe service will now start automatically when you log in and will be restarted if it crashes.\n\n## Getting Twitch API Credentials\n\n1. Create a Twitch Developer account at [dev.twitch.tv](https://dev.twitch.tv/)\n2. Register a new application to obtain a client ID and client secret\n3. Make sure to use valid credentials - invalid credentials will result in authentication errors like:\n   ```\n   Failed to authenticate with Twitch: 400 Client Error: Bad Request\n   ```\n\n## Troubleshooting\n\n### Common Issues\n\n#### Network Connectivity Problems\nIf you see errors like:\n```\nError fetching stream info: HTTPSConnectionPool(host='api.twitch.tv', port=443): Max retries exceeded with url: /helix/streams?user_login=channelname (Caused by NameResolutionError(\"\u003curllib3.connection.HTTPSConnection object at 0x...\u003e: Failed to resolve 'api.twitch.tv' ([Errno 8] nodename nor servname provided, or not known)\"))\n```\n\nThis indicates DNS resolution or network connectivity issues. The script now includes:\n- Network connectivity checks before making API calls\n- Automatic retry logic with exponential backoff\n- A watchdog service that restarts the script if it crashes\n\n#### Authentication Issues\nIf you encounter errors with Twitch authentication:\n- Verify your client ID and client secret are correct\n- Ensure your Twitch Developer application has the correct scopes\n- Check that your application is approved by Twitch\n\n### Log Files\nThe script generates log files that can help with troubleshooting:\n- `output.log`: Contains standard output messages\n- `error.log`: Contains error messages\n- `watchdog.log`: Contains watchdog service logs\n\n## License\n\nThis project is licensed under the BSD 2-Clause License - see the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetekoi%2Flive-notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdetekoi%2Flive-notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetekoi%2Flive-notify/lists"}