Mensa-API/scrape/scrape.go
2024-03-21 19:32:40 +01:00

30 lines
425 B
Go

package scrape
import (
"strings"
"golang.org/x/net/html"
)
func ScrapeBundesland(h string) []string {
tkn := html.NewTokenizer(strings.NewReader(h))
var mensen []string
for {
if tkn.Next() == html.ErrorToken {
return mensen
}
t := tkn.Token()
attr := t.Attr
for _, a := range attr {
if a.Key == "class" && a.Val == "elements" {
print(t.Data)
mensen = append(mensen, t.Data)
}
}
}
}