示例#1
0
func extractMetaLanguage(a *Article, metas *goquery.Selection) {
	lang, _ := a.Doc.FindMatcher(htmlTagMatcher).Attr("lang")

	if lang == "" {
		for _, s := range metaMatcherLangs {
			lang, _ = metas.FilterMatcher(s).Attr("content")
			if lang != "" {
				break
			}
		}
	}

	if lang != "" {
		a.Meta.Lang = lang[:2]
	}
}