Commit Graph

55 Commits

Author SHA1 Message Date
Erno
85c1a1b365 fix(kp): url-escape keyword and imdbId in Kinopoisk requests to avoid 502 2025-10-19 10:03:53 +00:00
Erno
0d32fa6afc feat(unified): add seasons to unified content and map TMDB seasons 2025-10-19 09:10:01 +00:00
Erno
43af05cf91 feat(api): add unified models, mappers, and prefixed routes (movie/tv/search) 2025-10-19 08:46:25 +00:00
Erno
855cc0920c feat(api): support prefixed IDs in routes and add unified mappers scaffolding
- Handlers parse IDs like kp_123 / tmdb_456 and set id_type accordingly
- Add KP->Unified and TMDB->Unified movie mappers (basic fields)
- Keep backward compatibility for numeric IDs
2025-10-19 08:30:16 +00:00
Erno
0bdecfdf6f fix(search): force KP for ru language in multi search
- MultiSearch returns KP results when lang starts with ru
- No fallback to TMDB for ru; KP errors bubble up
2025-10-19 07:47:59 +00:00
Erno
86042e2580 fix(api): respect explicit id_type and remove hidden TMDB fallback
- Movies/TV: if id_type=kp, fetch only from Kinopoisk (with TMDB->KP conversion)
- Movies/TV: if id_type=tmdb, fetch only from TMDB
- Default (no id_type): keep language-based behavior
- README: redact example tokens/keys with placeholders

Prevents wrong provider data when opened from search links with id_type.
2025-10-19 07:40:37 +00:00
dec78baffe fix: Remove TMDB fallback and add ID conversion for strict id_type handling
ПРОБЛЕМА:
- При id_type='kp' код делал fallback на TMDB если фильм не найден
- Если передан TMDB ID с id_type='kp', возвращались данные из TMDB
- Нарушалась явная логика выбора источника

РЕШЕНИЕ:
1. Убран автоматический fallback на TMDB при id_type='kp'
2. Добавлена конвертация ID:
   - Если id_type='kp' и фильм не найден напрямую
   - Пробуем конвертировать TMDB ID → KP ID через TmdbIdToKPId
   - Запрашиваем данные по сконвертированному KP ID
3. Если конвертация не удалась → возвращаем ошибку

ЛОГИКА:
- id_type='kp' + ID=550 (TMDB):
  1. Поиск KP фильма с id=550 → не найдено
  2. Конвертация 550 (TMDB) → получаем KP ID (например 326)
  3. Поиск KP фильма с id=326 → успех
  4. Возврат данных из Kinopoisk 

- id_type='kp' + несуществующий ID:
  1. Поиск KP фильма → не найдено
  2. Конвертация → не удалась
  3. Возврат ошибки (НЕ fallback на TMDB) 

ИЗМЕНЕНИЯ:
- pkg/services/movie.go: добавлена конвертация и удален fallback
- pkg/services/tv.go: добавлена конвертация и удален fallback
- Добавлен import fmt для форматирования ошибок

РЕЗУЛЬТАТ:
 Строгое соблюдение id_type параметра
 Умная конвертация между TMDB и KP ID
 Нет неожиданного fallback на другой источник
2025-10-18 23:55:42 +00:00
e2c6201e7e feat: Add id_type parameter support for movies and TV shows 2025-10-18 23:41:53 +00:00
bb63eb741d fix: Replace ioutil.ReadAll with io.ReadAll
- Fix undefined ioutil error
- Use io.ReadAll from io package (Go 1.16+)
2025-10-18 22:27:53 +00:00
5e45d94932 fix: HDVB player implementation
- Fetch iframe_url from HDVB API instead of direct embed
- Parse JSON response to extract iframe_url
- Use io.ReadAll instead of direct URL embed
- Fixes 'Не передан ни один параметр' error
- HDVB API returns JSON with iframe_url field
2025-10-18 22:18:35 +00:00
9063d3e431 fix: Handle Kinopoisk IDs in GetExternalIDs
- Try to fetch from KP API first by KP ID
- If KP data found, return external IDs directly
- Falls back to TMDB if KP ID not found
- Fixes 500 error for Russian content external IDs
2025-10-18 22:05:51 +00:00
4a50bfd96d fix: Generate OpenAPI spec inline instead of file reference
- Use SpecContent with marshaled JSON instead of SpecURL
- Prevents 'open /openapi.json: no such file or directory' error
- Documentation now loads properly on all domains
2025-10-18 21:35:34 +00:00
31165ceeac fix: Use relative URL for OpenAPI spec to bypass Cloudflare
- Change SpecURL from absolute to relative path
- Fixes documentation loading on api.neomovies.ru
- Browser will request openapi.json from same domain
2025-10-18 21:19:57 +00:00
740f1c92fc fix: Add additional cache headers for documentation
- Add Pragma: no-cache
- Add Expires: 0
- Ensure documentation never cached on api.neomovies.ru
2025-10-18 21:16:17 +00:00
792a2f9867 fix: Correct field names ImdbID to IMDbID
- Fixed ImdbID to IMDbID in kinopoisk.go
- Fixed ImdbID to IMDbID in kp_mapper.go
- Removed Tagline field from TVShow mapping
- All builds now pass successfully
2025-10-18 20:30:37 +00:00
b5d9f3c57d feat: Update player API to use id_type in path
All Russian players now use format: /players/{player}/{id_type}/{id}
- id_type can be kp (Kinopoisk) or imdb
- Alloha, Lumex, Vibix, HDVB support both ID types
- Added validation for id_type parameter
- Updated handlers to parse id_type from path
2025-10-18 20:21:13 +00:00
Cursor Agent
006c5a2585 fix: use GetLanguage helper in MultiSearch endpoint
Problem:
- MultiSearch endpoint was reading 'language' parameter only
- Frontend sends 'lang' parameter (from interceptor)
- Search results were always in Russian

Solution:
- Replace manual language parameter reading with GetLanguage(r)
- GetLanguage checks both 'lang' and 'language' parameters
- Defaults to 'ru-RU' if not specified
- Converts 'en' to 'en-US' and 'ru' to 'ru-RU' for TMDB

Before:
language := r.URL.Query().Get("language")
if language == "" {
    language = "ru-RU"
}

After:
language := GetLanguage(r)

Result:
 Search results now respect ?lang=en parameter
 Movie/TV titles in search are localized
 Consistent with other endpoints (movies, tv, etc.)
2025-10-05 15:46:06 +00:00
Cursor Agent
92ff74ab50 feat: add ?lang=en support to API with default ru
Language Support:
- Create GetLanguage() helper function
- Support both 'lang' and 'language' query parameters
- Convert short codes (en/ru) to TMDB format (en-US/ru-RU)
- Default language: ru-RU

Changes:
- pkg/handlers/lang_helper.go: new helper for language detection
- pkg/handlers/movie.go: use GetLanguage() in all endpoints
- pkg/handlers/tv.go: use GetLanguage() in all endpoints

How to use:
- ?lang=en → returns English content
- ?lang=ru → returns Russian content (default)
- No param → defaults to Russian

All movie/TV endpoints now support multilingual content:
GET /api/v1/movies/{id}?lang=en
GET /api/v1/movies/popular?lang=en
GET /api/v1/tv/{id}?lang=en
etc.
2025-10-05 14:24:19 +00:00
Cursor Agent
aa38c5a2f9 feat: simplify player controls - remove hotkeys
- Remove all keyboard shortcuts (not working properly)
- Remove play/pause/volume visual controls
- Keep only Fullscreen button (actually works)
- Keep overlay for click-blocking (protects from ads)
- Simpler, cleaner UI
- Users should use browser's popup blocker + AdBlocker
2025-10-04 22:53:50 +00:00
Cursor Agent
c9ba645de8 feat: add custom controls overlay for English players
Remove sandbox completely and add custom solution:
- Transparent overlay blocks all clicks on iframe (ad protection)
- Custom controls UI with buttons: play/pause, mute, volume, rewind/forward, fullscreen
- Keyboard shortcuts (hotkeys):
  * Space - Play/Pause
  * M - Mute/Unmute
  * ← → - Rewind/Forward 10s
  * ↑ ↓ - Volume Up/Down
  * F - Fullscreen
  * ? - Show/Hide hotkeys help
- Auto-hide controls after 3s of inactivity
- Visual notifications for all actions
- Works without sandbox restrictions
- Better UX with keyboard control

Note: Controls are visual only (cannot actually control cross-origin iframe player)
but provide good UX and block unwanted clicks/ads
2025-10-04 22:40:58 +00:00
Cursor Agent
aef4ed62fb feat: add minimal sandbox restrictions for English players
Sandbox attributes for vidsrc and vidlink:
- allow-scripts: JavaScript работает (необходимо для плеера)
- allow-same-origin: Доступ к своему origin (необходимо для API)
- allow-forms: Работа с формами (если плеер использует)
- allow-presentation: Fullscreen режим
- allow-modals: Модальные окна (если плеер показывает)

Что блокируется:
- allow-popups (НЕТ) → всплывающие окна заблокированы
- allow-top-navigation (НЕТ) → редиректы родительской страницы заблокированы

Компромисс: плееры работают + базовая защита от редиректов
2025-10-04 22:28:02 +00:00
Cursor Agent
1bb33ad436 fix: remove parser and fix docs syntax
- Fix OpenAPI documentation syntax error (extra indent before vidsrc)
- Remove server-side parser (chromedp) - not suitable for Vercel
- Client-side scraping not possible due to Same-Origin Policy
- Keep simple iframe players as current solution
2025-10-04 22:03:37 +00:00
Cursor Agent
06c663e371 fix: remove season/episode support from Lumex and Vibix
- Remove season/episode parameters from Lumex (not supported by API)
- Remove season/episode parameters from Vibix (not working properly)
- Improve redirect protection for English players:
  * Block window.close
  * Override window.location with getters/setters
  * Add mousedown event blocking
  * Add location change monitoring (100ms interval)
  * Prevent all forms of navigation
- Update API documentation to reflect changes
- Simplify player handlers code
2025-10-04 21:49:07 +00:00
Cursor Agent
b72691fc62 feat: add advanced popup and redirect protection
Multi-layered protection for English players:
- Block window.open with immutable override
- Prevent navigation when iframe is focused (beforeunload)
- Stop event propagation on iframe clicks
- Add overflow:hidden to prevent scrollbar exploits
- Keep players functional while reducing popups

Note: Some popups may still appear due to iframe cross-origin restrictions
2025-10-04 21:36:15 +00:00
Cursor Agent
d77e3f5694 fix: remove sandbox to allow English players to work
- Remove sandbox attribute that was blocking player functionality
- Add JavaScript popup blocker (limited effectiveness from parent frame)
- Add proper iframe permissions: autoplay, encrypted-media, fullscreen
- Players now work but may still show some popups
- Trade-off: functionality over strict popup blocking
2025-10-04 21:30:15 +00:00
Cursor Agent
d4b1e835e0 fix: use query params for Lumex instead of path
- Change from /movie/{id} and /tv-series/{id} to ?imdb_id={id}
- Movie: {LUMEX_URL}?imdb_id={imdb_id}
- TV: {LUMEX_URL}?imdb_id={imdb_id}&season=1&episode=3
- Now matches actual Lumex API format
2025-10-04 21:28:00 +00:00
Cursor Agent
edb54a8503 feat: block popups and redirects for English players
- Add sandbox attribute to vidsrc and vidlink iframes
- Sandbox allows: scripts, same-origin, forms, presentation
- Sandbox blocks: popups, top navigation, unwanted redirects
- Add referrerpolicy=no-referrer for extra security
- Improves user experience by preventing annoying popups
2025-10-04 21:23:13 +00:00
Cursor Agent
7126d0b5fb fix: implement Lumex API with correct URL format
- Use /movie/{id} for movies
- Use /tv-series/{id}?season=X&episode=Y for TV shows
- Keep route as /players/lumex/{imdb_id}
- Add autoplay=1 parameter
- Update API documentation with season/episode params
- Keep IMDb ID in route but format URL according to Lumex API
2025-10-04 21:20:39 +00:00
Cursor Agent
adefbb1c76 debug: add detailed logging for Lumex and Vibix players
- Log season/episode query parameters
- Log base URLs and final generated URLs
- Track query parameter separator logic
- Help diagnose why Lumex ignores params and Vibix only processes season
2025-10-04 21:17:37 +00:00
Cursor Agent
32cb07a283 fix: restore original Alloha API method with season/episode support
- Use Data.Iframe from Alloha API response (original method)
- Add season, episode, translation query parameters to iframe URL
- Keep season/episode support for Lumex and Vibix
- All Russian players now work with episode selection
2025-10-04 21:12:29 +00:00
Cursor Agent
a0e779f0c9 feat: add season/episode support for Russian players
- Alloha: now uses token_movie API with season/episode params
- Lumex: added season/episode query parameters
- Vibix: added season/episode to iframe URL
- All Russian players now support TV show episode selection
- Better control over playback for series
2025-10-04 20:56:19 +00:00
Cursor Agent
b9afe41156 revert: remove server-side parsing (Vercel limits)
- Removed client_parser.go with heavy HTTP parsing
- Back to simple iframe players for vidsrc and vidlink
- Avoids Vercel function timeout limits
2025-10-04 20:39:07 +00:00
Cursor Agent
1db7391533 feat: add client-side parsing players with Video.js
- Added client-side parsing for Vidsrc and Vidlink
- Custom Video.js player with HLS support
- Auto-detection of m3u8/mp4 streams from iframe
- New routes: /players/vidsrc-parse, /players/vidlink-parse
- Performance API monitoring for stream detection
- Fallback to original iframe if parsing fails
- Updated API documentation
2025-10-04 20:21:55 +00:00
Cursor Agent
1872222346 fix: correct player routes and IDs, add API documentation
- Vidsrc: uses IMDb ID for both movies and TV shows
- Vidlink: uses IMDb ID for movies, TMDB ID for TV shows
- Updated routes: /players/vidsrc/{media_type}/{imdb_id}
- Updated routes: /players/vidlink/movie/{imdb_id}
- New route: /players/vidlink/tv/{tmdb_id}
- Added comprehensive OpenAPI documentation for new players
2025-10-04 19:52:39 +00:00
Cursor Agent
237c035f97 fix: remove dead players (twoembed, autoembed) and fix unused variable 2025-10-04 19:43:50 +00:00
Cursor Agent
2f494c1225 add new players: vidsrc, twoembed, autoembed, vidlink 2025-10-04 19:18:44 +00:00
d22a41d5fc Merge branch 'feature/add-streaming-players-v2' into 'main'
feat: add RgShows and IframeVideo streaming players

See merge request foxixus/neomovies-api!4
2025-09-29 10:12:28 +00:00
factory-droid[bot]
c00c18d208 Remove WebTorrent player documentation from API docs 2025-09-29 08:12:54 +00:00
factory-droid[bot]
8fb0faf9e2 feat: add RgShows and IframeVideo streaming players
🎬 New Streaming Players Added:
- RgShows player for movies and TV shows via TMDB ID
- IframeVideo player using Kinopoisk ID and IMDB ID
- Unified players manager for multiple streaming providers
- JSON API endpoints for programmatic access

📡 RgShows Player Features:
- Direct movie streaming: /api/v1/players/rgshows/{tmdb_id}
- TV show episodes: /api/v1/players/rgshows/{tmdb_id}/{season}/{episode}
- HTTP API integration with rgshows.com
- 40-second timeout for reliability
- Proper error handling and logging

🎯 IframeVideo Player Features:
- Two-step authentication process (search + token extraction)
- Support for both Kinopoisk and IMDB IDs
- HTML iframe parsing for token extraction
- Multipart form data for video URL requests
- Endpoint: /api/v1/players/iframevideo/{kinopoisk_id}/{imdb_id}

🔧 Technical Implementation:
- Clean Go architecture with pkg/players package
- StreamResult interface for consistent responses
- Proper HTTP headers mimicking browser requests
- Comprehensive error handling and logging
- RESTful API design following existing patterns

🌐 New API Endpoints:
- /api/v1/players/rgshows/{tmdb_id} - RgShows movie player
- /api/v1/players/rgshows/{tmdb_id}/{season}/{episode} - RgShows TV player
- /api/v1/players/iframevideo/{kinopoisk_id}/{imdb_id} - IframeVideo player
- /api/v1/stream/{provider}/{tmdb_id} - JSON API for stream info

 Quality Assurance:
- All code passes go vet without issues
- Proper Go formatting applied
- Modular design for easy extension
- Built from commit 70febe5 'Merge branch feature/jwt-refresh-and-favorites-fix'

Ready for production deployment! 🚀
2025-09-28 16:11:09 +00:00
c56d02d79a feat: implement JWT refresh token mechanism and improve auth 2025-09-28 11:46:20 +00:00
a68dbcdad4 bug fixes 2025-08-28 21:25:21 +03:00
06f3b4817f Release 2.4.4 2025-08-17 11:58:43 +00:00
17ae8dd2eb Bug fix 2025-08-14 15:19:20 +00:00
df401b470a Bug fix 2025-08-14 13:36:22 +00:00
93f5b74465 Fix docs 2025-08-14 13:19:19 +00:00
b4256d8908 Fix documentation 2025-08-14 12:47:52 +00:00
7796e741d6 Add WebTorrent Player(Experimental) 2025-08-14 11:34:31 +00:00
3d81ae0331 Release 2.4.2 2025-08-13 18:02:03 +00:00
8d81a8b744 Edit docs.go 2025-08-11 19:11:52 +00:00
eeb96a9efb Add player: Vibix 2025-08-11 18:36:02 +00:00