utils

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package utils implements some utilities.

Index

Constants

This section is empty.

Variables

View Source
var ErrAPIBusy = errors.New("api busy")

Functions

func FindMails

func FindMails(str string, mails *[]*mail.Address) error

FindMails finds mails contained in str. If there are patterns LIKE an email address, they are appended to mails.

func LongInterval

func LongInterval() time.Duration

func MediumInterval

func MediumInterval() time.Duration

func OutputAsJSON

func OutputAsJSON(s interface{}) error

func SetAPIServer

func SetAPIServer(a *url.URL)

func ShortInterval

func ShortInterval() time.Duration

Types

type APIResult

type APIResult struct {
	CreateTime int        `json:"create_time"`
	Statistics VideoStats `json:"statistics"`
}

APIResult represents the response from API server.

type VideoStats

type VideoStats struct {
	DiggCount int `json:"digg_count"`
	PlayCount int `json:"play_count"`
}

VideoStats unites videos statistics cared in a structure.

func GetVideoStatsFromAPI

func GetVideoStatsFromAPI(url string) (createdTime int, vs VideoStats, err error)

GetVideoStatsFromAPI sends request to apiServer regarding url. It returns createdTime (time the video was posted) and vs (video statistics).

Jump to

Keyboard shortcuts

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