示例#1
0
func (feed *Feed) Fetch() error {
	var err error
	logger.Info("Started fetching feed: %s", feed.Url)

	rss.CacheParsedItemIDs(false)
	feed.RawData, err = rss.Fetch(feed.Url)
	if err != nil {
		return err
	}

	logger.Info("Finished fetching feed: %s", feed.Url)
	logger.Info("There are %d items in %s", len(feed.RawData.Items), feed.Url)
	return nil
}
示例#2
0
文件: api.go 项目: henriwi/gorss
func FetchFeeds(writer http.ResponseWriter, request *http.Request) {
	rss.CacheParsedItemIDs(false)
	feeds, err := db.GetAll()

	if err != nil {
		writer.WriteHeader(http.StatusInternalServerError)
	}

	if len(feeds) == 0 {
		return
	}

	responses := asyncFetchFeeds(feeds)

	result := []*rss.Feed{}
	for _, r := range responses {
		result = append(result, r.feed)
	}

	jsonResult, _ := json.Marshal(result)
	fmt.Fprintf(writer, string(jsonResult))
}
示例#3
0
文件: search.go 项目: i/multicraig
func init() {
	rss.CacheParsedItemIDs(false)
}