View Source CleanUnroll (clean_unroll v0.1.0)

Unroll and clean URLs by following redirects and removing tracking parameters.

Examples

iex> CleanUnroll.clean_unroll("https://t.co/shortened-tracked")
{:ok, "https://example.com/page?custom_param=value"}

iex> CleanUnroll.clean_unroll("https://t.co/shortened-tracked", ["custom_param"])
{:ok, "https://example.com/page"}

iex> CleanUnroll.clean("https://example.com/page?utm_source=twitter&id=123")
"https://example.com/page?id=123"

iex> CleanUnroll.unroll("https://t.co/shortened")
{:ok, "https://example.com/page"}

Summary

Functions

Removes tracking parameters from a URL.

Unrolls a URL and removes its tracking parameters.

Unrolls a URL.

Functions

clean(url, remove_params \\ [])

@spec clean(binary(), [binary()]) :: binary()

Removes tracking parameters from a URL.

Parameters

  • url - The URL to clean
  • remove_params - Additional query parameters to remove (optional)

clean_unroll(url, remove_params \\ [])

@spec clean_unroll(binary(), [binary()]) :: {:ok, binary()} | {:error, term()}

Unrolls a URL and removes its tracking parameters.

Parameters

  • url - The URL to process
  • remove_params - Additional query parameters to remove (optional)

unroll(url)

@spec unroll(binary()) :: {:ok, binary()} | {:error, term()}

Unrolls a URL.

Parameters

  • url - The URL to unroll