Retry oversized video downloads instead of giving up permanently
VK can briefly serve a not-yet-transcoded master stream on a capped-height URL right after a video is published, tripping the size check on the very first attempt. Treat that as transient (retry with a longer backoff) instead of failing permanently, and merge the fallback note into a single "Смотреть видео в VK" link instead of two separate lines. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -154,18 +154,18 @@ def build_media_unavailable_note(
|
||||
media_type = str(getattr(item, "media_type", "медиа") or "медиа")
|
||||
if not url:
|
||||
continue
|
||||
label = "Смотреть видео" if media_type == "video" else media_type
|
||||
if parse_mode == "html":
|
||||
lines.append(f'- <a href="{html.escape(url, quote=True)}">{html.escape(label)}</a>')
|
||||
if media_type == "video":
|
||||
target = vk_url or url
|
||||
label = "Смотреть видео в VK"
|
||||
else:
|
||||
lines.append(f"- {label}: {url}")
|
||||
target = url
|
||||
label = media_type
|
||||
if parse_mode == "html":
|
||||
lines.append(f'- <a href="{html.escape(target, quote=True)}">{html.escape(label)}</a>')
|
||||
else:
|
||||
lines.append(f"- {label}: {target}")
|
||||
if not lines:
|
||||
return ""
|
||||
if vk_url:
|
||||
if parse_mode == "html":
|
||||
lines.append(f'- <a href="{html.escape(vk_url, quote=True)}">Открыть пост в VK</a>')
|
||||
else:
|
||||
lines.append(f"- пост в VK: {vk_url}")
|
||||
header = "Не поместилось в пост:"
|
||||
if parse_mode == "html":
|
||||
header = f"<i>{html.escape(header)}</i>"
|
||||
|
||||
Reference in New Issue
Block a user