update pin-sha256, search view image

This commit is contained in:
deepzz0
2016-10-15 00:33:51 +08:00
parent 4f39fe4d70
commit 1bf197feef
5 changed files with 15 additions and 3 deletions

View File

@@ -35,3 +35,12 @@ func IgnoreHtmlTag(src string) string {
re, _ = regexp.Compile("\\s{1,}")
return re.ReplaceAllString(src, "")
}
func PickFirstImage(html string) string {
re, _ := regexp.Compile(`data-src="(.*?)"`)
sli := re.FindAllStringSubmatch(html, 1)
if len(sli) > 0 && len(sli[0]) > 1 {
return sli[0][1]
}
return ""
}