util

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

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

Go to latest
Published: Mar 10, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindCanonicalURL

func FindCanonicalURL(url string, secondTry bool) (out string)

FindCanonicalURL returns the canonical URL of an article if possible, else the original input is returned

func GetUserAgent

func GetUserAgent() string

func HashTagText

func HashTagText(words []string) (s string)

func LoadJSON

func LoadJSON(filename string, target interface{}) (err error)

func LogError

func LogError(err error, location string) bool

LogError returns logs and returns an error, if err is nil it returns false

func SaveJSON

func SaveJSON(filename string, source interface{}) (err error)

Types

type ArticleStore

type ArticleStore struct {
	// SeenArticles maps an article URL to the last time it was seen
	SeenArticles map[string]time.Time
	// contains filtered or unexported fields
}

func NewArticleStore

func NewArticleStore(filename string, keepDuration time.Duration) (*ArticleStore, error)

func (*ArticleStore) HasSeen

func (a *ArticleStore) HasSeen(url string) (seen bool, canonical string, err error)

func (*ArticleStore) MarkSeen

func (a *ArticleStore) MarkSeen(url, canonicalArticleURL string) error

func (*ArticleStore) ShouldIgnoreTweet

func (a *ArticleStore) ShouldIgnoreTweet(tweet *twitter.Tweet) (ignore bool)

Jump to

Keyboard shortcuts

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