Example #1
0
// GetArticleForSite is not guaranteed to give good results for all URLs
func GetArticleForSite(url string) (string, error) {
	page, err := utils.GetPage(url)
	if err != nil {
		return "", err
	}
	article := getArticle(page)
	return article, nil
}
Example #2
0
func GetMetaForSite(url string) (Meta, error) {
	page, err := utils.GetPage(url)
	if err != nil {
		return Meta{}, err
	}
	meta, err := extractMetaFromSiteData(page, url)
	if err != nil {
		return Meta{}, err
	}
	return meta, nil
}
Example #3
0
func ParseURL(url string) (AtomFeed, error) {
	var atomfeed AtomFeed
	page, err := utils.GetPage(url)
	if err != nil {
		return atomfeed, err
	}
	var rssfeed RSSFeed
	err = rssfeed.ParseFeed(page)
	if err == nil {
		af, _ := rssfeed.ConvertToAtomFeed()
		return af, nil
	}
	err = atomfeed.ParseFeed(page)
	if err != nil {
		return atomfeed, err
	}
	return atomfeed, err
}