Example #1
0
func main() {
	/*
		p, err := helper.GetPage("http://www.8mei.cc")
		fmt.Println("P>>>>>>>>>>>", p, err)
	*/
	//model.AtLinksPostImagesOnTopic(p)
	values := []string{}
	links, _ := helper.AtPages(p)
	for k, v := range links {
		fmt.Println("link #", k)
		content, _ := helper.GetPage(v)
		imgs, n := helper.GetImages(content)

		if n > 0 {
			for k, vv := range imgs {
				//vv为单图url 相对路径的处理较为复杂,这里暂时抛弃相对路径的图片 后续再修正
				if strings.HasPrefix(vv, "/") {
					vv = v + vv[1:]
				}
				fmt.Println("image #", k)
				if !helper.ContainsSets(values, vv) {
					values = append(values, vv)
				}
			}
		}
	}
	fmt.Println("values:", values)

}
Example #2
0
File: mm.go Project: rose312/mzr
func main() {

	s, e := helper.GetPage("http://www.aimmxiu.com/")
	fmt.Println(e)
	m, n := GetImages(s)
	fmt.Println("匹配", n, "张图:")
	fmt.Println(m)
}