twitter

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: AGPL-3.0 Imports: 15 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 Init

func Init()

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 {
	Tweet   *Tweet `json:"tweet"`
	Message string `json:"message"`
	Code    int    `json:"code"`
}

func (*FxTwitterApiResp) ToArtwork

func (resp *FxTwitterApiResp) ToArtwork() (*dto.FetchedArtwork, error)

type Media

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

type MediaItem

type MediaItem struct {
	Type         string  `json:"type"`
	URL          string  `json:"url"`                     // Direct link to the media
	Format       string  `json:"format,omitempty"`        // video's mime type or format, e.g. "video/mp4", "gif"
	ThumbnailUrl string  `json:"thumbnail_url,omitempty"` // for videos poster image
	Width        int     `json:"width"`
	Height       int     `json:"height"`
	Duration     float64 `json:"duration,omitempty"` // in seconds, for videos only
}

type Tweet

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

type Twitter

type Twitter struct {
	// contains filtered or unexported fields
}

func (*Twitter) FetchNewArtworks

func (t *Twitter) FetchNewArtworks(ctx context.Context, limit int) ([]*dto.FetchedArtwork, error)

func (*Twitter) GetArtworkInfo

func (t *Twitter) GetArtworkInfo(ctx context.Context, sourceURL string) (*dto.FetchedArtwork, error)

func (*Twitter) MatchesSourceURL

func (t *Twitter) MatchesSourceURL(text string) (string, bool)

func (*Twitter) PrettyFileName

func (t *Twitter) PrettyFileName(artwork shared.ArtworkLike, picture shared.PictureLike) string

PrettyFileName implements source.ArtworkSource.

Jump to

Keyboard shortcuts

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