A Telegram bot that helps users export their movie ratings from Kinopoisk (Russian movie database) to Letterboxd format. The bot processes HTML files containing user ratings and creates a CSV file compatible with Letterboxd's import feature.
You can either deploy your own bot, or use the hosted version: @KinoBoxdBot.
KinoUltraBoxd automates the migration of movie ratings from Kinopoisk to Letterboxd by:
- Parsing HTML files exported from Kinopoisk user rating pages
- Matching movies across multiple databases (IMDB, TMDB, WikiData)
- Handling manual disambiguation for ambiguous matches
- Generating CSV files ready for Letterboxd import
- Providing detailed statistics about the conversion process
- Node.js with TypeScript - Main runtime and language
- Telegraf - Telegram Bot Framework for handling user interactions
- Better SQLite3 - Local database for IMDB data caching
- Cheerio - HTML parsing for Kinopoisk data extraction
- Axios - HTTP client for API requests
- TMDB API - Movie database for title matching
- WikiData API - Additional movie metadata source
- Kinopoisk Dev API - Unofficial Kinopoisk API for enhanced matching
- IMDB Dataset - Local SQLite database for movie lookups
- Jest - Testing framework
- ts-jest - TypeScript support for Jest
- ESLint & TypeScript compiler - Code quality and type checking
KinoUltraBoxd/
├── bot.ts # Main bot entry point
├── models/
│ ├── FilmData.ts # Core data models
│ └── SessionModels.ts # Bot session state models
├── services/
│ ├── filmProcessingService.ts # Main film processing pipeline
│ ├── htmlParsingService.ts # Kinopoisk HTML parsing
│ ├── localImdbService.ts # Local IMDB database operations
│ ├── tmdbSearchService.ts # TMDB API integration
│ ├── kinopoiskDevService.ts # Kinopoisk API integration
│ ├── wikiDataService.ts # WikiData API integration
│ ├── letterboxdExportService.ts # CSV generation for Letterboxd
│ ├── statsReportService.ts # Export statistics generation
│ ├── telegramFileService.ts # File handling from Telegram
│ └── sessionManager.ts # User session persistence
├── manualSelectionHandler.ts # Interactive movie disambiguation
└── sessionStore.ts # Session storage implementation
api/
└── webhook.ts # Vercel webhook handler
tests/
├── htmlParsingService.test.ts # HTML parsing tests
└── localImdbService.test.ts # IMDB service tests
telegraf- Telegram bot frameworkbetter-sqlite3- SQLite database for IMDB datacheerio- Server-side jQuery for HTML parsingaxios- HTTP client for API requestsioredis- Redis client for session storagedotenv- Environment variable management
- HTML Parsing - Extract movie data from Kinopoisk HTML files
- Local IMDB Lookup - Match against local IMDB database
- WikiData Enrichment - Get additional metadata from WikiData
- TMDB Search - Search TMDB API for missing movies
- Kinopoisk API - Use unofficial API as fallback
- Manual Disambiguation - Interactive selection for ambiguous matches
- CSV Export - Generate Letterboxd-compatible CSV file
- Node.js 18+
- npm or yarn
- Telegram Bot Token (from @BotFather)
- Optional: Kinopoisk Dev API token (from @kinopoiskdev_bot)
- Clone and install dependencies:
git clone <repository-url>
cd KinoUltraBoxd
npm install- Environment setup:
Create a
.envfile in the root directory:
BOT_TOKEN=your_telegram_bot_token_here
TMDB_API_KEY=tmdb_token- Run tests:
npm test- Type checking:
npm run typecheck- Start development server:
npm run dev- Deploy to Vercel:
npm install -g vercel
vercel- Configure environment variables in Vercel:
BOT_TOKEN- Your Telegram bot tokenTMDB_API_KEY- TMDB token
- Set up Telegram webhook:
curl -X POST "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook" \
-H "Content-Type: application/json" \
-d '{"url": "https://your-vercel-app.vercel.app/api/webhook?secret=<WEBHOOK_SECRET>"}'npm run build- Compile TypeScript to JavaScriptnpm start- Run production buildnpm run dev- Development mode with hot reloadnpm test- Run test suitenpm run typecheck- TypeScript type checking
- Start the bot with
/start - Follow the
/helpcommand instructions to export HTML files from Kinopoisk - Upload HTML files to the bot
- Click "✅ Начать экспорт" to begin processing
- If prompted, provide a Kinopoisk Dev API token
- Manually disambiguate any unclear movie matches
- Download the generated
letterboxd.csvfile - Import the CSV to Letterboxd
The bot supports both rated and watched (but unrated) movies, handles pagination across multiple HTML files, and provides detailed statistics about the conversion process.