Fix duplicate posting, HTML escaping, restore sendRichMessage correctly

- Stop re-sending to a platform that already succeeded when the other
  platform failed (was causing duplicate posts on partial failure)
- Escape VK post text before sending with parse_mode=HTML instead of
  only escaping matched bracket-link substrings (bare & < > broke sends)
- Restore Telegram sendRichMessage (Bot API 10.1) ported faithfully from
  new_vk_parser's proven implementation, with fallback to standard
  send_photo/send_video/send_media_group
- Restore "media unavailable" note when a video/photo fails to download
  instead of silently dropping it
- Handle YouTube link attachments from VK posts (route into yt-dlp)
- MAX: chunk media beyond 10 items into follow-up messages instead of
  dropping them
- yt-dlp format selector no longer falls back to unconstrained height
- Wire up VK_RATE_LIMIT_RPS, drop unused Pillow dep and dead config fields
This commit is contained in:
2026-08-14 21:21:57 +05:00
parent d63d3fb937
commit 6a7a995d5f
8 changed files with 289 additions and 122 deletions
+5 -4
View File
@@ -123,13 +123,14 @@ class MediaProcessor:
"--no-playlist",
"--match-filter", f"duration <= {settings.video_max_duration_sec}",
"--merge-output-format", "mp4",
# Every fallback keeps the height cap: without it yt-dlp can pull an
# arbitrarily large/high-res stream only to have it discarded afterwards
# by the size check below, burning bandwidth and the whole timeout budget.
"-f", (
f"best[height<={settings.video_max_height}][filesize<{max_size}]"
f"/best[height<={settings.video_max_height}]"
f"/bestvideo[height<={settings.video_max_height}][filesize<{max_size}]+bestaudio/best"
f"/bestvideo[height<={settings.video_max_height}]+bestaudio/best"
f"/best[filesize<{max_size}]"
f"/best"
f"/bestvideo[height<={settings.video_max_height}][filesize<{max_size}]+bestaudio"
f"/bestvideo[height<={settings.video_max_height}]+bestaudio"
),
"--quiet", "--no-warnings",
])