{"id":26506870,"url":"https://github.com/realies/tgmr","last_synced_at":"2025-03-20T22:57:25.135Z","repository":{"id":278689510,"uuid":"936451792","full_name":"realies/tgmr","owner":"realies","description":"A Telegram bot that automatically downloads and replies with media content when users share links in messages.","archived":false,"fork":false,"pushed_at":"2025-03-10T20:39:44.000Z","size":310,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T21:31:55.918Z","etag":null,"topics":["media","reply","telegram","yt-dlp"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/realies.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}},"created_at":"2025-02-21T05:34:55.000Z","updated_at":"2025-03-10T20:39:44.000Z","dependencies_parsed_at":"2025-02-21T06:38:40.301Z","dependency_job_id":null,"html_url":"https://github.com/realies/tgmr","commit_stats":null,"previous_names":["realies/tgmr"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realies%2Ftgmr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realies%2Ftgmr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realies%2Ftgmr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realies%2Ftgmr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/realies","download_url":"https://codeload.github.com/realies/tgmr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244706520,"owners_count":20496571,"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":["media","reply","telegram","yt-dlp"],"created_at":"2025-03-20T22:57:24.736Z","updated_at":"2025-03-20T22:57:25.130Z","avatar_url":"https://github.com/realies.png","language":"TypeScript","readme":"# TGMR (Telegram Media Reply)\n\nA Telegram bot that automatically downloads and replies with media content when users share links in messages. Built with TypeScript and powered by yt-dlp and gallery-dl.\n\n## Features\n\n- Automatically processes media links in messages (supports all platforms that yt-dlp and gallery-dl can handle)\n- Downloads high-quality images from supported platforms (Instagram, Twitter, etc.)\n- Sends audio-only content as voice messages\n- Sends videos with thumbnails and proper aspect ratio\n- Works in both private chats and groups\n- Includes detailed media information in captions (format, quality, size)\n- Efficient temporary file management\n- Docker support for easy deployment\n\n## Requirements\n\n- Docker (recommended for deployment)\n- Telegram Bot Token (get it from [@BotFather](https://t.me/botfather))\n- yt-dlp (for video/audio content)\n- gallery-dl (for image content)\n\n## Quick Start\n\n1. Set your bot token:\n   ```bash\n   # Edit docker-compose.yml and replace 'your_telegram_bot_token_here' with your token\n   ```\n\n2. Start the bot:\n   ```bash\n   docker compose up -d\n   ```\n\n## Configuration\n\nEnvironment variables in `docker-compose.yml`:\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `BOT_TOKEN` | Telegram Bot API token | Required |\n| `MAX_FILE_SIZE` | Maximum file size in bytes | 50000000 (50MB) |\n| `DOWNLOAD_TIMEOUT` | Download timeout in seconds | 300 |\n| `RATE_LIMIT` | Maximum requests per minute | 10 |\n| `COOLDOWN` | Cooldown between requests in seconds | 60 |\n| `TMP_DIR` | Temporary directory for downloads | /tmp/tgmr |\n| `SUPPORTED_DOMAINS` | Comma-separated list of domains | youtube.com,youtu.be,... |\n| `COOKIES_FILE` | Default cookies file (fallback) | '' |\n| `COOKIES_FILE_*` | Site-specific cookies (e.g., COOKIES_FILE_YOUTUBE) | '' |\n\n### Cookie Configuration\n\nTo handle rate limiting and authentication for different platforms, you can configure cookies per site:\n\n1. Create a `cookies` directory in your project:\n   ```bash\n   mkdir cookies\n   ```\n\n2. Add your cookie files for different sites. You can export cookies from your browser using extensions like \"Get cookies.txt\" or similar:\n   ```bash\n   cookies/\n   ├── youtube.txt     # YouTube cookies\n   ├── instagram.txt   # Instagram cookies\n   ├── twitter.txt     # Twitter/X cookies\n   └── default.txt     # Default fallback cookies\n   ```\n\n3. Configure the cookie files in `docker-compose.yml`:\n   ```yaml\n   environment:\n     # Default fallback for all sites\n     - COOKIES_FILE=/cookies/default.txt\n     # Site-specific cookies\n     - COOKIES_FILE_YOUTUBE=/cookies/youtube.txt\n     - COOKIES_FILE_INSTAGRAM=/cookies/instagram.txt\n     - COOKIES_FILE_TWITTER=/cookies/twitter.txt  # Used for both twitter.com and x.com\n   volumes:\n     - ./cookies:/cookies  # Yt-dlp updates cookies\n   ```\n\nSpecial cases:\n- `COOKIES_FILE_YOUTUBE` works for both youtube.com and youtu.be\n- `COOKIES_FILE_TWITTER` works for both twitter.com and x.com\n- For other sites, use `COOKIES_FILE_SITENAME` where SITENAME is the domain without the extension\n- `COOKIES_FILE` serves as a fallback for sites without specific cookie files\n\nNote: Keep your cookie files secure as they contain sensitive authentication data.\n\n## Usage\n\n1. Add the bot to a group or start a private chat\n2. Send a media link\n3. The bot will reply with:\n   - A voice message for audio-only content\n   - A video file for video content\n   - Caption including title and technical details\n\n### Commands\n\n- `/start` - Introduction message\n- `/help` - Usage instructions\n\n## Development\n\n```bash\nyarn install\nyarn build\nyarn dev\n```\n\n### Project Structure\n\n```\ntgmr/\n├── src/\n│   ├── bot/        # Bot initialization and core logic\n│   ├── config/     # Configuration management\n│   ├── handlers/   # Message and command handlers\n│   ├── services/   # Media download and processing\n│   ├── types/      # TypeScript type definitions\n│   └── utils/      # Helper functions\n└── dist/           # Compiled JavaScript\n```\n\n## Security\n\n- File size restrictions prevent abuse\n- Rate limiting protects against spam\n- Temporary files are automatically cleaned up\n- Docker container runs as non-root user\n- Input validation for all URLs\n\n## License\n\nMIT License\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealies%2Ftgmr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealies%2Ftgmr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealies%2Ftgmr/lists"}