Skip to content

Commit

Permalink
Removing xurls Dependency
Browse files Browse the repository at this point in the history
Turns out are some point we dropped the need for it.
  • Loading branch information
s-rah committed Oct 28, 2016
1 parent 21e04c6 commit 835babd
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions utils/url_parsing.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
package utils

import (
"github.com/mvdan/xurls"
"regexp"
"strings"
)

func ExtractDomains(content string) []string {
domains := xurls.Strict.FindAllString(content, -1)
cssurlregex := regexp.MustCompile(`(?i)url\((.*?)\)`)
cssDomains := cssurlregex.FindAllString(content, -1)
for _, cssDomain := range cssDomains {
if strings.HasPrefix(strings.ToLower(cssDomain), "url(") {
cssDomain = cssDomain[4 : len(cssDomain)-1]
}
if !strings.HasSuffix(cssDomain, ":before") && !strings.HasSuffix(cssDomain, ":after") {
domains = append(domains, cssDomain)
}
}
return domains
}

func WithoutSubdomains(urlhost string) string {
urlParts := strings.Split(urlhost, ".")
if len(urlParts) < 2 {
Expand Down

0 comments on commit 835babd

Please sign in to comment.