diff --git a/redirector/htmlparser.go b/redirector/htmlparser.go index 6d8c5e0..47dfe26 100644 --- a/redirector/htmlparser.go +++ b/redirector/htmlparser.go @@ -21,14 +21,15 @@ func FetchHeadElements(targetURL string) (string, error) { return html.Parse(resp.Body) } - // Recursive function to find all elements within
excluding scripts and stylesheets + // Recursive function to find all elements within excluding scripts, stylesheets, and style tags findHeadElements := func(n *html.Node) []*html.Node { var headElements []*html.Node var traverse func(*html.Node) traverse = func(n *html.Node) { if n.Type == html.ElementNode && n.Data == "head" { for child := n.FirstChild; child != nil; child = child.NextSibling { - if child.Data != "script" && child.Data != "link" { + // Exclude script, link, and style tags + if child.Data != "script" && child.Data != "link" && child.Data != "style" { headElements = append(headElements, child) } } diff --git a/routes.yaml b/routes.yaml index 4d14084..4e2b306 100644 --- a/routes.yaml +++ b/routes.yaml @@ -2,7 +2,7 @@ a: https://a.com abc: https://hehe.com db: https://distrobe.at doner: kebab123 +go: https://google.com me: https://alileza.me test: https://google.com tos: tos -