示例#1
0
func (a *ArticleIn) Process(article *m.Article) error {

	extractedSection := e.ExtractSectionInfo(a.Doc)

	sections := make([]string, len(extractedSection.Sections))
	for i, section := range extractedSection.Sections {
		sections[i] = section
	}

	article.Source = a.Site
	article.ArticleId = a.ArticleId
	article.Headline = e.ExtractTitleFromDocument(a.Doc)
	article.Subheadline = e.ExtractSubheadlineFromDocument(a.Doc)
	article.Section = extractedSection.Section
	article.Subsection = extractedSection.Subsection
	article.Sections = sections
	article.Created_at = time.Now()
	article.Updated_at = time.Now()
	article.Timestamp = e.ExtractTimestamp(a.Doc)
	article.Url = a.Url
	article.Photo = e.ExtractPhotoInfo(a.Doc)

	return nil
}