Web Scraper | Golang
So you are interested in news and events and you want to track the latest news and headlines. And I guess you are familiar with the concept of RSS Rich Site Summary. Okay,😃Let’s start to build a simple Golang application to fetch the latest news and headlines with in a second.
package main
import (
"fmt"
"github.com/mmcdole/gofeed"
)
func feed(){
fp := gofeed.NewParser()
feed, err := fp.ParseURL("http://feeds.reuters.com/reuters/UKTopNews")
if err != nil {
panic(err)
}
for _, item := range feed.Items {
fmt.Println(item.Title, item.PublishedParsed)
}
}
func main(){
feed()
}
Read other posts