webhose

package
v0.0.0-...-c878a74 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package webhose provides an interface to the webhose.io API. Install with

go get github.com/news-r/go-webhose

Get a free API key on webhose's website then create a client and get articles.

client := &webhose.NewsClient{Token: "xxXXXX-XXxxXX-xXXxxxXX-xXXXx", Query: "go programming language"}
news := webhose.GetArticles(client, 2) // client and number of pages of result

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Articles

type Articles struct {
	News []News
}

Articles pages of news articles

func GetArticles

func GetArticles(client *NewsClient, pages int) *Articles

GetArticles returns news articles

type Entities

type Entities struct {
	Persons       []Entity
	Organizations []Entity
	Locations     []Entity
}

Entities entities extracted

type Entity

type Entity struct {
	Name      string `json:"name"`
	Sentiment string `json:"sentiment"`
}

Entity entity extracted

type Facebook

type Facebook struct {
	Likes    int `json:"likes"`
	Comments int `json:"comments"`
	Shares   int `json:"shares"`
}

Facebook facebook data

type News

type News struct {
	Posts            []Posts `json:"posts"`
	TotalResults     int     `json:"total_results"`
	MoreResultsAvail int     `json:"moreResultsAvailable"`
	Next             string  `json:"next"`
	RequestsLeft     int     `json:"requestsLeft"`
}

News news and blog articles

type NewsClient

type NewsClient struct {
	Token     string `url:"token"`
	Query     string `url:"q"`
	Sort      string `url:"sort,omitempty"`
	Order     string `url:"order,omitempty"`
	From      string `url:"from,omitempty"`
	TimeStamp string `url:"ts,omitempty"`
	Format    string `url:"format,omitempty"`
	Size      int    `url:"size,omitempty"`
	Accuracy  string `url:"accuracy_confidence,omitempty"`
	Highlight bool   `url:"highlight,omitempty"`
	Latest    bool   `url:"latest,omitempty"`
}

NewsClient creates a client to collect news and blog articles

type Posts

type Posts struct {
	Thread         Thread   `json:"thread"`
	UUID           string   `json:"uuid"`
	URL            string   `json:"url"`
	OrdInThread    int      `json:"ord_in_thread"`
	Author         string   `json:"author"`
	Published      string   `json:"published"`
	Title          string   `json:"title"`
	Text           string   `json:"text"`
	HighlightText  string   `json:"highlightText"`
	HighlightTitle string   `json:"highlightTitle"`
	Language       string   `json:"language"`
	ExternalLinks  []string `json:"external_links"`
	Entities       Entities `json:"entities"`
}

Posts articles fetched

type Shares

type Shares struct {
	Shares int `json:"shares"`
}

Shares number of social shares

type Social

type Social struct {
	Facebook    Facebook
	Gplus       Shares
	Pinterest   Shares
	LinkedIn    Shares
	StumbleUpon Shares
	Vk          Shares
}

Social social interactions

type Thread

type Thread struct {
	UUID              string   `json:"uuid"`
	URL               string   `json:"url"`
	SiteFull          string   `json:"site_full"`
	Site              string   `json:"site"`
	SiteSection       string   `json:"site_section"`
	SiteCategories    []string `json:"site_categories"`
	SectionTitle      string   `json:"section_title"`
	Title             string   `json:"title"`
	TitleFull         string   `json:"title_full"`
	Published         string   `json:"published"`
	RepliesCount      int      `json:"replies_count"`
	ParticipantsCount int      `json:"participants_count"`
	SiteType          string   `json:"site_type"`
	Country           string   `json:"country"`
	SpamScore         float32  `json:"spam_score"`
	MainImage         string   `json:"main_image"`
	PerformanceScore  int      `json:"performance_score"`
	DomainRank        int      `json:"domain_rank"`
	Social            Social   `json:"social"`
}

Thread details on thread

Jump to

Keyboard shortcuts

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