twitter

package
v0.37.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidURL    = errors.New("invalid tweet URL")
	ErrIndexOOB      = errors.New("index out of bounds")
	ErrRequestFailed = errors.New("request twitter url failed")
)

Functions

func GetTweetPath

func GetTweetPath(sourceURL string) string

Types

type Author

type Author struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Username string `json:"screen_name"` // Twitter username
}

type FxTwitterApiResp

type FxTwitterApiResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Tweet   *Tweet `json:"tweet"`
}

func (*FxTwitterApiResp) ToArtwork

func (resp *FxTwitterApiResp) ToArtwork() (*types.Artwork, error)

type Media

type Media struct {
	Photos []MediaItem `json:"photos"`
}

type MediaItem

type MediaItem struct {
	Type   string `json:"type"`
	URL    string `json:"url"` // Direct link to the media
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

type Tweet

type Tweet struct {
	URL    string `json:"url"`
	ID     string `json:"id"`
	Text   string `json:"text"`
	Author Author `json:"author"`
	Media  *Media `json:"media"`
}

type Twitter

type Twitter struct{}

func (*Twitter) Config

func (t *Twitter) Config() *config.SourceCommonConfig

func (*Twitter) FetchNewArtworks

func (t *Twitter) FetchNewArtworks(limit int) ([]*types.Artwork, error)

func (*Twitter) FetchNewArtworksWithCh

func (t *Twitter) FetchNewArtworksWithCh(artworkCh chan *types.Artwork, limit int) error

func (*Twitter) GetArtworkInfo

func (t *Twitter) GetArtworkInfo(sourceURL string) (*types.Artwork, error)

func (*Twitter) GetCommonSourceURL

func (t *Twitter) GetCommonSourceURL(url string) string

func (*Twitter) GetFileName

func (t *Twitter) GetFileName(artwork *types.Artwork, picture *types.Picture) string

func (*Twitter) GetPictureInfo

func (t *Twitter) GetPictureInfo(sourceURL string, index uint) (*types.Picture, error)

func (*Twitter) GetSourceURLRegexp

func (t *Twitter) GetSourceURLRegexp() *regexp.Regexp

func (*Twitter) Init

func (t *Twitter) Init()

Jump to

Keyboard shortcuts

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