Files
quixotic/README.md
Andrey Kondratev 2bfb456cf3 Initial commit: Complete Quixotic Telegram MiniApp implementation
- Set up Express.js server with YouTube search and MP3 conversion API
- Created Telegram Web App frontend with responsive design
- Implemented SQLite database for user management and history
- Added Telegram Bot integration with commands and Web App support
- Configured FFmpeg-based audio conversion pipeline
- Added comprehensive documentation and deployment guides

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-25 10:37:07 +05:00

175 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 🎵 Quixotic - YouTube to MP3 Telegram MiniApp
Telegram miniapp для поиска музыки на YouTube и конвертации в MP3.
## Возможности
- 🔍 Поиск видео на YouTube
- 🎵 Конвертация в MP3 с помощью FFmpeg
- 📱 Telegram Web App интерфейс
- 💾 SQLite база данных
- 📊 История поиска
- 🤖 Telegram Bot интеграция
## Установка
### 1. Клонирование и установка зависимостей
```bash
git clone <repository-url>
cd quixotic
npm install
```
### 2. Установка FFmpeg
**macOS:**
```bash
brew install ffmpeg
```
**Ubuntu/Debian:**
```bash
sudo apt update
sudo apt install ffmpeg
```
**Windows:**
Скачайте с [ffmpeg.org](https://ffmpeg.org/download.html)
### 3. Создание Telegram бота
1. Напишите [@BotFather](https://t.me/BotFather) в Telegram
2. Создайте нового бота: `/newbot`
3. Получите токен бота
4. Настройте Web App: `/newapp`
### 4. Настройка окружения
```bash
cp .env.example .env
```
Отредактируйте `.env`:
```env
TELEGRAM_BOT_TOKEN=your_bot_token_here
WEB_APP_URL=https://your-domain.com
PORT=3000
```
## Запуск
### Разработка
```bash
npm run dev
```
### Продакшн
```bash
npm start
```
## Структура проекта
```
quixotic/
├── src/
│ ├── server.js # Express сервер
│ ├── bot.js # Telegram бот
│ ├── youtube.js # YouTube API
│ └── database.js # SQLite база данных
├── public/
│ ├── index.html # Web App интерфейс
│ ├── style.css # Стили
│ └── script.js # JavaScript
├── database/ # SQLite файлы
├── downloads/ # MP3 файлы
└── package.json
```
## API Endpoints
- `POST /api/search` - Поиск видео
- `POST /api/convert` - Конвертация в MP3
- `GET /downloads/:filename` - Скачивание файлов
- `GET /health` - Проверка здоровья
## База данных
SQLite с таблицами:
- `users` - пользователи Telegram
- `search_history` - история поиска
- `downloads` - загруженные файлы
## Деплой
### Heroku
1. Установите [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli)
2. Создайте приложение:
```bash
heroku create quixotic-app
```
3. Установите buildpacks:
```bash
heroku buildpacks:add --index 1 https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
heroku buildpacks:add --index 2 heroku/nodejs
```
4. Настройте переменные:
```bash
heroku config:set TELEGRAM_BOT_TOKEN=your_token
heroku config:set WEB_APP_URL=https://quixotic-app.herokuapp.com
```
5. Деплой:
```bash
git push heroku main
```
### VPS (Ubuntu)
```bash
# Обновление системы
sudo apt update && sudo apt upgrade -y
# Установка Node.js
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# Установка FFmpeg
sudo apt install ffmpeg -y
# Клонирование проекта
git clone <repository-url>
cd quixotic
npm install
# Настройка PM2
sudo npm install -g pm2
pm2 start src/server.js --name quixotic
pm2 startup
pm2 save
# Nginx (опционально)
sudo apt install nginx -y
# Настройте reverse proxy на порт 3000
```
## Мониторинг
```bash
# Логи сервера
pm2 logs quixotic
# Статус
pm2 status
# Перезапуск
pm2 restart quixotic
```
## Лицензия
MIT License