mirror of
https://github.com/LeRoid-hub/Mensa-API.git
synced 2025-01-31 11:44:55 +00:00
30 lines
425 B
Go
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)
|
|
}
|
|
}
|
|
}
|
|
}
|