An open API service indexing awesome lists of open source software.

https://github.com/slimdestro/gourlnormalizer

url normalizer[RFC 3986]-Golang
https://github.com/slimdestro/gourlnormalizer

go golang golang-package norm normalization rfc rfc3986 seotools

Last synced: 5 months ago
JSON representation

url normalizer[RFC 3986]-Golang

Awesome Lists containing this project

README

          

# (+)go-url-normalize[RFC 3986]
#### Normalize URL | Count unique normalized URL | Count unique normalized URL per TLD

[![N|Solid](https://upload.wikimedia.org/wikipedia/commons/thumb/0/05/Go_Logo_Blue.svg/60px-Go_Logo_Blue.svg.png)](https://dev.to/slimdestro)

## Installation

Install the package by doing go get:

```sh
go get github.com/slimdestro/gourlnormalizer
```

Three exported methods that you can use in your modules are:

```sh
NormalizeURL(url string)
CountUniqueNormalizedUrls(url []string)
CountUniqueNormalizedUrlsPerTopLevelDomain(url []string)
```

## Example

```sh
package main

import (
"fmt"
"github.com/slimdestro/gourlnormalizer"
)
func main() {
normalizedUrl,_ := normalizer.NormalizeURL("https://example.com?b=2&a=1")
fmt.Println(normalizedUrl)
// compare both url to see what has changed

urls__ := []string{"https://example.com?a=1&b=2", "https://example.com?b=2&a=1"}
fmt.Println(normalizer.CountUniqueNormalizedUrls(urls__))

urls___ := []string{"https://tempo.com", "https://example.com", "https://subdomain.example.com"}
fmt.Println(normalizer.CountUniqueNormalizedUrlsPerTopLevelDomain(urls___))
}

```

## Author

[slimdestro(Mukul Mishra)](https://linktr.ee/slimdestro)