newsapi

package module
v0.0.0-...-d791758 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2020 License: MIT Imports: 6 Imported by: 0

README

NEWSAPI

This library makes it about as painless as possible to retrieve articles from a variety of news sources, using newsapi. Quick, dirty golang bindings. Either set the NEWSAPI environment variable when integrating this library in your code, or set newsapi.token

Examples

Search: NEWSAPI=sometoken newsapi.Search("A search term")

Search for a specific date: NEWSAPI=sometoken newsapi.SearchForDate("A search term", "2020-01-01")

For complete examples, see the unit tests.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	Author      string
	Title       string
	Description string
	URL         string
	PublishedAt time.Time `json:publishedAt`
	Content     string
	UrlToImage  string `json:urlToImage`
}
func Search(terms string) ([]Article, error)

Search news terms

func SearchForDate

func SearchForDate(terms string, date time.Time) ([]Article, error)

Search news terms on the specific date

func SearchForDateAndDomain

func SearchForDateAndDomain(terms string, date time.Time, domain string) ([]Article, error)

Search news terms on a specific date and domain

func SearchForDomain

func SearchForDomain(terms string, domain string) ([]Article, error)

Search news terms on a specific domain

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL