Mak5er and Claude Fable 5
caffc343af
refactor: apply full-project audit — bug fixes, performance, deduplication
...
Full-codebase audit (149 raw findings, 57 verified and applied).
Fixes:
- download resume: recompute Range header per retry attempt; never resume
preallocated multipart .part files (silent media corruption)
- inline sends: canonical error tail (rate-limit/queue-busy/timeout/failure)
for all platforms; YouTube inline no longer strands tokens in
'processing' for 6h
- admin mailing: exclude banned users; fix Telegram error-text matching
- middlewares: instantiate once and share across message/callback/inline
so antiflood/ban state no longer fragments
- event loop: move ZIP compression, JSON state persistence, admin FS
walks, PIL/ffmpeg/ffprobe work off the loop
- download queue: prune idle per-user scopes; cancelled leader releases
joined duplicate requests
- worker subprocess: disable log sinks (stderr error protocol and log
rotation no longer race the parent)
- third-party loggers route through app handlers instead of lastResort
- tiktok: fix mojibake reaction emoji; per-user settings in doc callback;
per-URL locks for short-URL expansion; parallel photo-set downloads
- ci: fix broken yt-dlp auto-bump workflow baseline
- db: drop redundant analytics_events indexes (migration 000010)
Refactoring:
- services/inline/send_flow.py: shared inline delivery flow for all five
platforms (~640 duplicated lines removed)
- services/media/audio_flow.py: shared MP3 pipeline (was duplicated 6x
across youtube/youtube_inline/soundcloud/spotify)
- CobaltMediaService base + shared Cobalt response parsing
- services/platforms/ytdlp_helpers.py: shared yt-dlp scaffolding
- register_inline_send_handlers: one chosen_inline_result/callback
registration factory for 8 handlers
- merge pinterest/threads single-media and media-group flows
- logging decorator factory; remove ~11 dead repository methods
Tests: 470 -> 518 passing, coverage 77.3% -> 80.9% (CI gate 74%).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com >
2026-07-26 16:25:59 +03:00
Mak5er
be4016a8a3
perf: harden downloader and runtime lifecycle
2026-07-09 23:59:34 +03:00
mak5er
83b425393c
feat: add adaptive download queue, retries, and session observability
2026-02-11 17:01:46 +02:00
mak5er
c7fed30df2
Improve download UX: status, timeouts, caption truncation
...
- Add status messages (edit_text) + timeouts for YouTube/TikTok downloads\n- Fix TikTok slowness: short-url expansion timeout/cache, less global locking\n- Truncate captions to Telegram limits and escape HTML\n- Tune downloader concurrency and HTTP session connector\n- Update/add tests; pytest: 56 passed, 6 skipped
2026-02-11 01:08:16 +02:00
mak5er
fcf75526cf
Refactor YouTube handler to utilize a new resilient downloader
...
- Introduced a new `ResilientDownloader` class in `utils/download_manager.py` for improved download handling with support for HTTP range requests, retries, and resumable downloads.
- Updated `youtube.py` to replace the previous download logic with the new downloader, enhancing performance and reliability.
- Removed the old `download_manager.py` and `http_client.py` services, consolidating functionality into the `utils` directory.
- Adjusted download methods to log metrics and handle errors more effectively.
- Increased the maximum file size limit for downloads to 1.5 GB to accommodate larger media files.
- Improved handling of YouTube streams, including better fallback mechanisms for downloading media.
- Updated inline query handling for YouTube Shorts to use the new downloader.
2025-12-17 11:41:03 +02:00