Mensa-API/scrape/scrape.go

30 lines
425 B
Go
Raw Normal View History

2024-03-21 18:32:40 +00:00
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)
}
}
}
}