cats en tags
This commit is contained in:
@@ -211,11 +211,11 @@ func doArticle(filename string, url string, timestamp time.Time, needUpdate bool
|
||||
return false
|
||||
}
|
||||
|
||||
cats := make([]string, 0)
|
||||
tags := make([]string, 0)
|
||||
var buffer bytes.Buffer
|
||||
for _, i := range doc.Graph {
|
||||
p(buffer.WriteString(html.UnescapeString(i.ArticleBody)))
|
||||
cats = append(cats, i.ArticleSection...)
|
||||
tags = append(tags, i.ArticleSection...)
|
||||
}
|
||||
text := buffer.String()
|
||||
|
||||
@@ -245,11 +245,11 @@ func doArticle(filename string, url string, timestamp time.Time, needUpdate bool
|
||||
|
||||
fp, err := os.Create(filename + ".txt")
|
||||
p(err)
|
||||
if len(cats) == 0 {
|
||||
p(fmt.Fprintln(fp, "##META text cat ="))
|
||||
if len(tags) == 0 {
|
||||
p(fmt.Fprintln(fp, "##META text tag ="))
|
||||
} else {
|
||||
for _, cat := range cats {
|
||||
p(fmt.Fprintf(fp, "##META text cat = %s\n", fixSpace(cat)))
|
||||
for _, tag := range tags {
|
||||
p(fmt.Fprintf(fp, "##META text tag = %s\n", fixSpace(tag)))
|
||||
}
|
||||
}
|
||||
p(fp.WriteString(text))
|
||||
|
||||
Reference in New Issue
Block a user