fix(douyin): normalize modal_id URLs to direct video format before yt-dlp#40
Conversation
…ess theme integration On Windows, the native title bar color followed the system theme and clashed with the app's own theme. This removes native decorations and renders custom minimize/maximize/close buttons in the frontend, matching the approach used by macOS overlay title bar. Adds required Tauri v2 window permissions.
…-dlp
Douyin's web interface uses modal overlay URLs (e.g. /user/…?modal_id=123,
/jingxuan?modal_id=123) when viewing videos from profile pages, search
results, and curated feeds. yt-dlp does not recognize these URL variants
and fails with "Unsupported URL".
Add normalize_url() to transform any douyin.com URL containing a numeric
modal_id query parameter into the canonical /video/{id} format that yt-dlp
expects. Applied to all 8 yt-dlp invocation points in the backend and the
frontend deep-link normalizer. Includes 13 unit tests.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f774af3e2d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| // Must be a douyin.com host | ||
| if !lower_base.contains("douyin.com/") { |
There was a problem hiding this comment.
Match Douyin hostname exactly before URL rewrite
normalize_douyin treats any base string containing "douyin.com/" as a Douyin URL, so inputs like https://notdouyin.com/watch?modal_id=123 are incorrectly rewritten to https://www.douyin.com/video/123. That silently changes non-Douyin user input into a different target and can download the wrong content; this should parse and validate the hostname (e.g. exact douyin.com/www.douyin.com) instead of using substring matching.
Useful? React with 👍 / 👎.
Summary
/user/…?modal_id=123,/jingxuan?modal_id=123,/jingxuan/music?modal_id=123) when viewing videos from profile pages, search results, and curated feeds. yt-dlp does not recognize these URL variants and fails withERROR: Unsupported URL.normalize_url()insecurity.rsto transform anydouyin.comURL containing a numericmodal_idquery parameter into the canonical/video/{id}format that yt-dlp expects.download.rs,video.rs,metadata.rs,channels.rs) and the frontend deep-link normalizer (external-link.ts).Affected URL patterns
douyin.com/user/self?modal_id=123…douyin.com/video/123…douyin.com/jingxuan?modal_id=123…douyin.com/video/123…douyin.com/jingxuan/search/…?modal_id=123…douyin.com/video/123…douyin.com/jingxuan/music?modal_id=123…douyin.com/video/123…douyin.com/user/MS4wLjA…?modal_id=123…douyin.com/video/123…URLs already in
/video/{id}format are left unchanged.Test plan
cargo checkpassescargo testpassestsc -bpasses