Repository navigation
fix: 修复抖音相关的 3 个核心 issue (#435 / #315 / #325) - #515
Open
zzuu080603 wants to merge 3 commits into
Open
zzuu080603 wants to merge 3 commits into
zzuu080603 wants to merge 3 commits into
Conversation
added 3 commits
November 10, 2026 08:31
…e correctly (ihmily#435) EMOJI_PATTERN was missing variation selectors (U+FE0F), zero-width joiners (U+200D) and skin-tone modifiers, so names made only of emoji (e.g. 👁️, 👨👩👧👦) left invisible characters in the save path and recording failed silently while the card stayed 'recording'. - extend EMOJI_PATTERN with VS16/ZWJ/keycap/skin-tone/misc-symbol ranges - add INVISIBLE_CHAR_PATTERN to strip zero-width/control chars from names - fall back to the platform anchor name (then the localized default) when a custom streamer name cleans to empty, so the path is never None
…ile links (ihmily#315) Some Douyin profiles return an empty unique_id and only expose short_id (both work in live.douyin.com/<id> URLs), which broke mobile-shared profile short links. streamget's DouyinUtils.get_unique_id raises RuntimeError in that case, so apply an idempotent monkey-patch at import time: on failure/empty result, re-request the share page and extract short_id. UnsupportedUrlError keeps propagating unchanged since callers rely on it to tell room links from profile links.
When an anchor disconnects and reconnects, the old stream URL stops delivering data while ffmpeg (or the direct-download task) keeps waiting on it: the card stays 'recording' for hours but nothing is written. - sample the output directory size every 15s; when it stops growing for stalled_stream_timeout seconds (default 90, 0 disables) or nothing was ever written, stop the recorder gracefully and let check_if_live restart it with the fresh stream URL (recheck now also runs for stall-triggered stops) - DirectStreamDownloader.stop_download: cancel the task after the 10s grace timeout so a hung HTTP read can no longer leak the task and keep the output file locked on Windows
7 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
本 PR 修复 3 个抖音相关的高关注度 issue,均为根因分析 + 修复 + 单元测试验证过的改动(26 项测试全部通过,对全平台通用,不止抖音):
1️⃣ #435 显示「录制中」但文件未保存(emoji 主播名)
根因:
EMOJI_PATTERN缺少变体选择符(U+FE0F)、零宽连接符(U+200D)、肤色修饰符等区间。主播名只含 emoji 时(如 👁️、👨👩👧👦),清洗后残留不可见字符进入保存路径,录制静默失败且状态卡死。修复:补齐 emoji 区间 + 新增
INVISIBLE_CHAR_PATTERN清除零宽/控制字符 + 名称清洗为空时回退平台原始名,保存路径永不为空。2️⃣ #315 手机分享短链无法解析(unique_id 为空)
根因:上游 streamget 的
DouyinUtils.get_unique_id只提取unique_id,部分账号该字段为空、仅有short_id(两者均可拼接直播间地址),上游直接抛 RuntimeError。修复:在
DouyinHandler加载时打幂等 monkey-patch,失败/空串时回退提取short_id;UnsupportedUrlError保持原样传播。备注:根因在上游库,建议同步修复 streamget;此补丁作为过渡方案,streamget 结构变化时自动跳过。
3️⃣ #325 主播掉线重连后不停止录制但无数据写入
根因:录制循环只检查
should_stop/进程退出码,ffmpeg 挂在死流上时进程不死、文件零增长,状态挂数小时。修复:新增输出目录大小停滞检测(每 15s 采样,90s 零增长或全程 0 字节判定死流,
stalled_stream_timeout可配、0 禁用),判定后优雅停止并经recheck_live_status用新流地址自动重启;顺带修复stop_download超时后不 cancel 任务导致的句柄泄漏(Windows 文件锁定)。测试
Fixes #435
Fixes #315
Fixes #325