hn

package
v0.0.0-...-5b391e0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package hn provides functions to fetch data from hacker news.

Index

Constants

View Source
const (
	// TopStoriesURL fetches top stories from HN
	TopStoriesURL = "https://hacker-news.firebaseio.com/v0/topstories.json"
	// StoryLinkURL fetches a story given its id
	StoryLinkURL = "https://hacker-news.firebaseio.com/v0/item/%d.json"
	// PostLinkURL is the HN URL for given id
	PostLinkURL = "https://news.ycombinator.com/item?id=%d"
)

Variables

This section is empty.

Functions

func FetchHNStoriesOf

func FetchHNStoriesOf(ctx context.Context, ids []int) ([]*app.Item, error)

FetchHNStoriesOf fetches itsm from given ids

func FetchIds

func FetchIds(ctx context.Context, limit int) ([]int, error)

FetchIds fetches item ids with top limit

func FetchItem

func FetchItem(ctx context.Context, itemID int) (*app.Item, error)

FetchItem fetches item with itemID from HN

func FetchStoriesFrom

func FetchStoriesFrom(ctx context.Context, ids <-chan int) ([]*app.Item, error)

FetchStoriesFrom is a concurrent implementation of FetchHNStoriesOf

Types

This section is empty.

Jump to

Keyboard shortcuts

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