Skip to main content

youtube: remove the `ra` query parameter from YouTube URLs

ID
7f504e8
date
2026-11-15 20:48:14+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
c0cd2d7
message
youtube: remove the `ra` query parameter from YouTube URLs
changed files
4 files, 12 additions, 3 deletions

Changed files

CHANGELOG.md (133 → 209)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index b6d3630..2d7d5dc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # CHANGELOG
 
+## v1.0.1 - 2026-11-15
+
+Remove the `ra` query parameter from YouTube URLs.
+
 ## v1.0.0 - 2026-09-27
 
 Initial release.

Cargo.lock (10157 → 10157)

diff --git a/Cargo.lock b/Cargo.lock
index b7c3025..14e2f22 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -141,7 +141,7 @@ checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486"
 
 [[package]]
 name = "clean-url"
-version = "1.0.0"
+version = "1.0.1"
 dependencies = [
  "anyhow",
  "assert_cmd",

Cargo.toml (247 → 247)

diff --git a/Cargo.toml b/Cargo.toml
index 869bd51..8d50c88 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "clean-url"
-version = "1.0.0"
+version = "1.0.1"
 edition = "2024"
 
 [dependencies]

src/clean_url.rs (30623 → 30785)

diff --git a/src/clean_url.rs b/src/clean_url.rs
index 61b6fa4..33a4b44 100644
--- a/src/clean_url.rs
+++ b/src/clean_url.rs
@@ -92,7 +92,7 @@ pub fn clean_url(url: &str) -> String {
 
     // Remove &feature=youtu.be from YouTube URLs
     if parsed_url.netloc.ends_with("youtube.com") {
-        remove_query_params(&mut parsed_url, &["app", "feature"]);
+        remove_query_params(&mut parsed_url, &["app", "feature", "ra"]);
     }
 
     // Remove any tracking parameters which:
@@ -514,6 +514,11 @@ mod clean_url_tests {
             "https://www.youtube.com/watch?v=51HbzsFhh04"
         ),
 
+        youtube_ra: (
+            "https://www.youtube.com/watch?v=haLGKBWAsRs&ra=m",
+            "https://www.youtube.com/watch?v=haLGKBWAsRs"
+        ),
+
         single_utm_tracker: (
             "https://example.com?utm_medium=social",
             "https://example.com",