Fix redirect rules to target youtube-nocookie embeds#2
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
| "priority": 1, | ||
| "action": { | ||
| "type": "redirect", | ||
| "redirect": { "regexSubstitution": "https://yout-ube.com/watch?v=\\1" } | ||
| "redirect": { | ||
| "regexSubstitution": "https://www.youtube-nocookie.com/embed/\\1" | ||
| } | ||
| }, | ||
| "condition": { | ||
| "regexFilter": "^https?://youtu\\.be/([\\w-]{11})$", | ||
| "regexFilter": "^https?://youtu\\.be/([\\w-]{11})(?:\\?[^#]*)?$", | ||
| "resourceTypes": ["main_frame", "sub_frame"] |
There was a problem hiding this comment.
Preserve query parameters when rewriting YouTube URLs
The new redirect rules rewrite any matched YouTube URL to https://www.youtube-nocookie.com/embed/<videoId> but they drop the original query string entirely. Share links such as watch?v=<id>&t=90, watch?v=<id>&list=…, or https://youtu.be/<id>?t=30 now redirect to an embed that always starts from the beginning and loses playlist or other context. Prior to this commit, regexSubstitution forwarded the entire path and query (\2), so start times and other parameters were preserved. This regression affects any link that depends on query parameters for desired playback behaviour.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68f6969441708330bb7c81e49ba70639