reddit

package
v0.0.0-...-36ca5f9 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBadResponse indicates a bad or unexpected response from the webapi
	ErrBadResponse error = errors.New("bad response")
)

Functions

This section is empty.

Types

type Embed

type Embed struct {
	HTML string
	Type string

} // html embedded media

type Post

type Post struct {
	ID        string
	Title     string
	Text      string
	Subreddit string
	Author    string
	Permalink string
	ImageURL  string
	IsImage   bool
	IsVideo   bool
	IsEmbed   bool
	Embed     Embed
}

Post is a very simplified variation of a JSON response given from the reddit api

func PostByID

func PostByID(postID string) (Post, error)

PostByID fetches the post with the corresponding ID A post ID is normally six characters long

func (Post) DownloadVideo

func (p Post) DownloadVideo() (*os.File, error)

func (Post) URL

func (p Post) URL() string

type PostType

type PostType string
const (
	PostTypeImage       PostType = "image"
	PostTypeVideoHosted PostType = "hosted:video"
	PostTypeVideoEmbed  PostType = "rich:video"
	PostTypeSelf        PostType = "self"
)

Jump to

Keyboard shortcuts

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