feedfinder is a library for finding RSS and Atom feeds on a website.
- Install the package:
go get github.com/0x2E/feedfinder- Import the package:
package main
import (
"context"
"fmt"
"github.com/0x2E/feedfinder"
)
func main() {
link := "https://github.com/golang/go"
feeds, err := feedfinder.Find(context.Background(), link, nil)
if err != nil {
panic(err)
}
for _, feed := range feeds {
fmt.Printf("title: %s\tlink: %s\n", feed.Title, feed.Link)
}
}
// Output:
// title: golang/go commits link: https://github.com/golang/go/commits.atom
// title: golang/go releases link: https://github.com/golang/go/releases.atom
// title: golang/go tags link: https://github.com/golang/go/tags.atom
// title: golang/go wiki link: https://github.com/golang/go/wiki.atomIt tries to find feeds in the following ways:
Parsing HTML:
<link>with typeapplication/rss+xml,application/atom+xml,application/json,application/feed+json<a>containing the wordrss
Well-known paths:
atom.xml,feed.xml,rss.xml,index.xmlatom.json,feed.json,rss.json,index.jsonfeed/,rss/
Third party services:
- GitHub: official rules
- Reddit: official wiki
- YouTube: ref
- Parsing feed with gofeed