Exemple #1
0
func (this *SourceMediawiki) FilterPicUrl(src string) (dst []string) {
	t := rep_mw_pic.FindAllStringSubmatch(src, -1) // TODO: 有的WIKI有两个以上的图片地址 需要补完算法
	dst = make([]string, 0, len(t))
endf:
	for _, v := range t {
		var raw string
		for i, s := range v[1:] {
			if s != "" {
				if i == 2 {
					dst = append(dst, s)
					continue endf
				}
				raw = s
				break
			}
		}

		if raw == "" {
			continue
		}
		raw = strings.Replace(raw, " ", "_", -1)
		h := util.Md5String(raw)
		raw = this.PicBase + h[0:1] + "/" + h[0:2] + "/" + raw
		dst = append(dst, raw)
	}
	return
}
Exemple #2
0
func (this *Tieba) getSign(parm []string) (sign string) {
	sign = util.Md5String(fmt.Sprint(strings.Join(parm, ""), "tiebaclient!!!"))
	return
}