hackernews

package
v0.0.0-...-8a54050 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HNScraper

type HNScraper struct {
	// contains filtered or unexported fields
}

func NewScraper

func NewScraper(httpc *http.Client) (*HNScraper, error)

func (*HNScraper) FetchItem

func (s *HNScraper) FetchItem(ctx context.Context, refId string) (model.Story, bool, error)

func (*HNScraper) FetchItems

func (s *HNScraper) FetchItems(ctx context.Context) ([]model.Story, error)

func (*HNScraper) Name

func (s *HNScraper) Name() string

type Hits

type Hits struct {
	// HighlightResult HighlightResult `json:"_highlightResult,omitempty"`
	Tags   []string `json:"_tags"`
	Author string   `json:"author"`
	// Children        []int           `json:"children,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
	CreatedAtI  int       `json:"created_at_i"`
	NumComments int       `json:"num_comments,omitempty"`
	ObjectID    string    `json:"objectID"`
	Points      int       `json:"points,omitempty"`
	StoryID     int       `json:"story_id,omitempty"`
	StoryText   string    `json:"story_text,omitempty"`
	Title       string    `json:"title"`
	UpdatedAt   time.Time `json:"updated_at"`
	URL         string    `json:"url"`
}

func (*Hits) GetType

func (h *Hits) GetType() string

func (*Hits) HasTag

func (h *Hits) HasTag(s string) bool

type Item

type Item struct {
	Type     string `json:"type"`
	Children []Item `json:"children"`
	ObjectID int    `json:"id"`
	Points   int    `json:"points,omitempty"`
	StoryID  int    `json:"story_id,omitempty"`
	Title    string `json:"title"`
	URL      string `json:"url"`
}

func (*Item) NumComments

func (i *Item) NumComments() int

type SearchResult

type SearchResult struct {
	// Exhaustive          Exhaustive          `json:"exhaustive"`
	// ExhaustiveNbHits    bool                `json:"exhaustiveNbHits"`
	// ExhaustiveTypo      bool                `json:"exhaustiveTypo"`
	Hits []Hits `json:"hits"`
	// HitsPerPage         int                 `json:"hitsPerPage"`
	// NbHits              int                 `json:"nbHits"`
	// NbPages             int                 `json:"nbPages"`
	// Page                int                 `json:"page"`
	// Params              string              `json:"params"`
	ProcessingTimeMS int `json:"processingTimeMS"`
	// ProcessingTimingsMS ProcessingTimingsMS `json:"processingTimingsMS"`
	// Query               string              `json:"query"`
	ServerTimeMS int `json:"serverTimeMS"`
}

Jump to

Keyboard shortcuts

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