-
Notifications
You must be signed in to change notification settings - Fork 7
/
sitemaps.go
33 lines (23 loc) · 893 Bytes
/
sitemaps.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package grobotstxt
type sitemapExtractor struct {
sitemaps []string
}
func (f *sitemapExtractor) Sitemaps(robotsBody string) []string {
Parse(robotsBody, f)
return f.sitemaps
}
// Sitemaps extracts all "Sitemap:" values from the given robots.txt content.
func Sitemaps(robotsBody string) []string {
return (&sitemapExtractor{}).Sitemaps(robotsBody)
}
func (f *sitemapExtractor) HandleRobotsStart() {
f.sitemaps = nil
}
func (f *sitemapExtractor) HandleSitemap(lineNum int, value string) {
f.sitemaps = append(f.sitemaps, value)
}
func (f *sitemapExtractor) HandleRobotsEnd() {}
func (f *sitemapExtractor) HandleUserAgent(lineNum int, value string) {}
func (f *sitemapExtractor) HandleAllow(lineNum int, value string) {}
func (f *sitemapExtractor) HandleDisallow(lineNum int, value string) {}
func (f *sitemapExtractor) HandleUnknownAction(lineNum int, action, value string) {}