Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 572 Bytes

File metadata and controls

42 lines (32 loc) · 572 Bytes

Client for newsapi.org api written in Golang.

Install:
go get github.com/bas24/newsapi

Getting articles:

package main

import(
	"fmt"
	"github.com/bas24/newsapi"
)

func main(){
	result, err := newsapi.GetArticles("YOUR_API_KEY")
	if err != nil {
		fmt.Println(err)
	}
	for _, v := range result{
		fmt.Println(v)
	}
}

If you want to get the topic for feed source, just:

package main

import(
	"fmt"
	"github.com/bas24/newsapi"
)

func main(){
	topic := newsapi.GetTopic("bbc-news")
	fmt.Println(topic)
}