Ejemplo n.º 1
0
func (x load_result) to_feedentity() (feed.FeedEntity, error) {
	if x.ResponseStatus != http.StatusOK || x.ResponseData == nil || x.ResponseData.Feed == nil {
		return feed.FeedEntity{}, gf_error{x.ResponseStatus, x.ResponseDetails}
	}

	var v []feed.FeedEntry
	f := x.ResponseData.Feed
	s := feed.FeedSource{
		Name:        strip_html_tags(f.Title),
		Uri:         f.FeedUrl,
		WebSite:     f.Website,
		Description: f.Description,
		Type:        feed.FeedSourceType(f.Type),
		Period:      default_update_minutes, // minutes
	}

	for _, e := range f.Entries {
		ne := feed.FeedEntry{
			Parent:  s.Uri,
			Title:   e.Title,
			Uri:     e.Link,
			Summary: e.ContentSnippet,
			Content: e.Content,
			Tags:    e.Categories,
			PubDate: int64(e.PublishedDate),
			Author:  e.Author,
		}
		v = append(v, ne)
	}
	return feed.FeedEntity{s, v}, nil
}
Ejemplo n.º 2
0
func source_type_map(sourcetype string) uint {
	return feed.FeedSourceType(sourcetype)
}