Golang port of this python library (not actively maintained).
It finds links to rss/atom/rdf feeds in a website. Better support for Twitter and reddit links and option to add more extensions
Wrote this to use in rewrite of this bot in golang.
package main
import (
"fmt"
"github.com/nikhil1raghav/feedfinder"
)
func main() {
f := feedfinder.NewFeedFinder()
url:="old.reddit.com/r/unixporn"
links, _ := f.FindFeeds(url)
for _, link := range links {
fmt.Println(link)
}
}
Feedfinder supports following options
CheckAll
: if set totrue
initiates exhaustive search for feedurls, defaultfalse
UserAgent
: Custom user-agent string for the crawler, defaultchrome user agent on windows
Timeout
: timeout duration for the feedfinding operation (not supported yet but option is there), default60 seconds
package main
import (
"flag"
"fmt"
"time"
"github.com/nikhil1raghav/feedfinder"
"github.com/nikhil1raghav/feedfinder/values"
)
func main() {
f := feedfinder.NewFeedFinder(
feedfinder.UserAgent(values.ChromeUserAgent), //custom user agent
feedfinder.CheckAll(true), //to check if url not found easily
feedfinder.TimeOut(10*time.Second), //timeout to avoid long waiting times
)
url := flag.String("URL", "https://raghavnikhil.com/", "url to find feeds for")
flag.Parse()
links, _ := f.FindFeeds(*url)
for _, link := range links {
fmt.Println(link)
}
}