Пример #1
0
func process(file string, selector string, attrList []string, csv *csv.Writer) {
	webdevdata.ProcessMatchingTags(file, selector, func(node *html.Node) {
		content := []string{file, node.Data}
		for _, attr := range attrList {
			if attr != "" {
				content = append(content, webdevdata.GetAttr(attr, node.Attr))
			}
		}
		csv.Write(content)
	})
}
Пример #2
0
func main() {
	flag.Parse()
	file := flag.Arg(0)

	csv := csv.NewWriter(os.Stdout)
	selector := "meta[name]" // All meta tags with name attribute
	webdevdata.ProcessMatchingTags(file, selector, func(node *html.Node) {
		name := webdevdata.GetAttr("name", node.Attr)
		csv.Write([]string{file, name})
	})

	csv.Flush()
}
Пример #3
0
func main() {
	flag.Parse()
	file := flag.Arg(0)

	csv := csv.NewWriter(os.Stdout)
	selector := "html[manifest]" // all html tags with manifest attribute
	webdevdata.ProcessMatchingTags(file, selector, func(node *html.Node) {
		manifest := webdevdata.GetAttr("manifest", node.Attr)
		if manifest != "" {
			csv.Write([]string{file, manifest})
		}
	})

	csv.Flush()
}