api

package
v2.0.0-...-9b771dd Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJsonCookieJar

func CreateJsonCookieJar(l core.ILogger, cookieFile string) http.CookieJar

func CreateTikTokMediaFactory

func CreateTikTokMediaFactory(l core.ILogger, api YoutubeApi) core.IMediaFactory

Types

type CoreFactory

type CoreFactory struct {
}

type Entity

type Entity struct {
	Urls  []URL   `json:"urls,omitempty"`
	Media []Media `json:"media"`
}

Entity ...

type Error

type Error struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

Error ...

type GraphQLResponse

type GraphQLResponse struct {
	Errors []Error             `json:"errors,omitempty"`
	Data   GraphQLResponseData `json:"data"`
}

type GraphQLResponseCore

type GraphQLResponseCore struct {
	UserResults GraphQLResponseUserResults `json:"user_results"`
}

type GraphQLResponseData

type GraphQLResponseData struct {
	TweetResult GraphQLResponseTweetResult `json:"tweetResult"`
}

type GraphQLResponseTweetResult

type GraphQLResponseTweetResult struct {
	Result GraphQLResponseTweetResultResult `json:"result"`
}

type GraphQLResponseTweetResultResult

type GraphQLResponseTweetResultResult struct {
	Core   GraphQLResponseCore `json:"core"`
	Legacy Tweet               `json:"legacy"`
	RestId string              `json:"rest_id"`
}

type GraphQLResponseUserResult

type GraphQLResponseUserResult struct {
	Legacy   User   `json:"legacy"`
	RestId   string `json:"rest_id"`
	Verified bool   `json:"is_blue_verified"`
}

type GraphQLResponseUserResults

type GraphQLResponseUserResults struct {
	Result GraphQLResponseUserResult `json:"result"`
}

type GraphQLVariables

type GraphQLVariables struct {
	IncludePromotedContent bool   `json:"includePromotedContent"`
	TweetId                string `json:"tweetId"`
	WithCommunity          bool   `json:"withCommunity"`
	WithVoice              bool   `json:"withVoice"`
}

type HttpClient

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

func CreateHttpClient

func CreateHttpClient() *HttpClient

func (*HttpClient) GetContent

func (c *HttpClient) GetContent(url core.URL) (string, error)

GetContent is a core.IHttpClient interface implementation

func (*HttpClient) GetContentType

func (c *HttpClient) GetContentType(url core.URL) (string, error)

GetContentType is a core.IHttpClient interface implementation

func (*HttpClient) GetRedirectLocation

func (c *HttpClient) GetRedirectLocation(url core.URL) (core.URL, error)

func (*HttpClient) SetHeader

func (c *HttpClient) SetHeader(key string, value string)

SetHeader remembers all passed values and applies it to every request

type IgCaption

type IgCaption struct {
	Text string
}

type IgReel

type IgReel struct {
	Items []IgReelItem
}

type IgReelClipsMetadata

type IgReelClipsMetadata struct {
	MusicInfo         *IgReelMusicInfo         `json:"music_info"`
	OriginalSoundInfo *IgReelOriginalSoundInfo `json:"original_sound_info"`
}

type IgReelItem

type IgReelItem struct {
	Code          string
	User          IgUser
	Caption       IgCaption
	VideoDuration float64             `json:"video_duration"`
	VideoVersions []IgReelVideo       `json:"video_versions"`
	ClipsMetadata IgReelClipsMetadata `json:"clips_metadata"`
}

type IgReelMusicAssetInfo

type IgReelMusicAssetInfo struct {
	DisplayArtist          string `json:"display_artist"`
	Title                  string
	ProgressiveDownloadURL string `json:"progressive_download_url"`
}

type IgReelMusicInfo

type IgReelMusicInfo struct {
	MusicAssetInfo IgReelMusicAssetInfo `json:"music_asset_info"`
}

type IgReelOriginalSoundInfo

type IgReelOriginalSoundInfo struct {
	ProgressiveDownloadURL string `json:"progressive_download_url"`
}

type IgReelVideo

type IgReelVideo struct {
	Width  int
	Height int
	URL    string
}

type IgUser

type IgUser struct {
	Username string
	FullName string `json:"full_name"`
}

type InstAPI

type InstAPI interface {
	GetReel(string) (*IgReel, error)
}

func CreateInstagramAPI

func CreateInstagramAPI(l core.ILogger, cookie string) InstAPI

CreateInstagramAPI

type InstagramAPI

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

Instagram API

func (*InstagramAPI) GetReel

func (api *InstagramAPI) GetReel(urlString string) (*IgReel, error)

type JsonCookieJar

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

func (*JsonCookieJar) Cookies

func (jar *JsonCookieJar) Cookies(u *url.URL) []*http.Cookie

func (*JsonCookieJar) SetCookies

func (jar *JsonCookieJar) SetCookies(u *url.URL, cookies []*http.Cookie)

type Media

type Media struct {
	MediaUrlHttps string    `json:"media_url_https"`
	Type          string    `json:"type"`
	VideoInfo     VideoInfo `json:"video_info,omitempty"`
}

Media ...

type OpenGraphParser

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

func CreateOpenGraphParser

func CreateOpenGraphParser(l core.ILogger) *OpenGraphParser

func (*OpenGraphParser) CreateMedia

func (ogp *OpenGraphParser) CreateMedia(HTMLString string) ([]*core.Media, error)

CreateMedia is a core.IMediaFactory interface implementation

type OutlineAPI

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

func CreateOutlineAPI

func CreateOutlineAPI(l core.ILogger, url string) *OutlineAPI

CreateOutlineAPI is a default OutlineAPI factory

func (*OutlineAPI) CreateKey

func (api *OutlineAPI) CreateKey(chatID int64, name string) (*VpnKey, error)

func (*OutlineAPI) DeleteKey

func (api *OutlineAPI) DeleteKey(key *core.VpnKey) error

func (*OutlineAPI) GetKeys

func (api *OutlineAPI) GetKeys(chatID int64) ([]*VpnKey, error)

type OutlineAPIKeys

type OutlineAPIKeys struct {
	AccessKeys []*VpnKey
}

type Telebot

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

Telebot is a telegram API

func CreateTelebot

func CreateTelebot(token string, logger core.ILogger) *Telebot

CreateTelebot is a default Telebot factory

func (*Telebot) AddHandler

func (t *Telebot) AddHandler(handler ...interface{})

AddHandler register object as one of core.Handler's

func (*Telebot) Download

func (t *Telebot) Download(image *core.Image) (*core.File, error)

Download is a core.IImageDownloader interface implementation

func (*Telebot) Run

func (t *Telebot) Run()

Run bot loop

func (*Telebot) SetupInfo

func (t *Telebot) SetupInfo()

SetupInfo ...

type TelebotAdapter

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

TelebotAdapter combines Telebot and core.IBot

func (*TelebotAdapter) Delete

func (a *TelebotAdapter) Delete(message *core.Message) error

Delete is a core.IBot interface implementation

func (*TelebotAdapter) Edit

func (a *TelebotAdapter) Edit(message *core.Message, what interface{}, options ...interface{}) (*core.Message, error)

Edit is a core.IBot interface implementation

func (*TelebotAdapter) GetCommands

func (a *TelebotAdapter) GetCommands(chatID int64) ([]core.Command, error)

GetCommands is a core.IBot interface implementation

func (*TelebotAdapter) IsUserMemberOfChat

func (a *TelebotAdapter) IsUserMemberOfChat(user *core.User, chatID int64) bool

IsUserMemberOfChat is a core.IBot interface implementation

func (*TelebotAdapter) SendAlbum

func (a *TelebotAdapter) SendAlbum(images []*core.Image) ([]*core.Message, error)

SendAlbum is a core.IBot interface implementation

func (*TelebotAdapter) SendImage

func (a *TelebotAdapter) SendImage(image *core.Image, caption string) (*core.Message, error)

SendImage is a core.IBot interface implementation

func (*TelebotAdapter) SendMedia

func (a *TelebotAdapter) SendMedia(media *core.Media) (*core.Message, error)

SendMedia is a core.IBot interface implementation

func (*TelebotAdapter) SendMediaAlbum

func (a *TelebotAdapter) SendMediaAlbum(medias []*core.Media) ([]*core.Message, error)

SendMediaAlbum is a core.IBot interface implementation

func (*TelebotAdapter) SendText

func (a *TelebotAdapter) SendText(text string, params ...interface{}) (*core.Message, error)

SendText is a core.IBot interface implementation

func (*TelebotAdapter) SendVideo

func (a *TelebotAdapter) SendVideo(vf *core.Video, caption string) (*core.Message, error)

SendVideo is a core.IBot interface implementation

func (*TelebotAdapter) SetCommands

func (a *TelebotAdapter) SetCommands(chatID int64, commands []core.Command) error

SetCommands is a core.IBot interface implementation

type Telegraph

type Telegraph struct {
}

Telegraph uploads files to telegra.ph

func CreateTelegraphAPI

func CreateTelegraphAPI() *Telegraph

CreateTelegraphAPI is a default Telegraph factory

func (*Telegraph) Upload

func (t *Telegraph) Upload(file *core.File) (core.URL, error)

Upload is a core.IFileUploader interface implementation

type TikTokMediaFactory

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

func (*TikTokMediaFactory) CreateMedia

func (factory *TikTokMediaFactory) CreateMedia(url string) ([]*core.Media, error)

type Tweet

type Tweet struct {
	ID               string  `json:"id_str"`
	FullText         string  `json:"full_text"`
	Entities         Entity  `json:"entities"`
	ExtendedEntities Entity  `json:"extended_entities,omitempty"`
	User             User    `json:"user,omitempty"`
	QuotedStatus     *Tweet  `json:"quoted_status,omitempty"`
	Errors           []Error `json:"errors,omitempty"`
}

Tweet is a twitter api representation of a single tweet

type TweetScreenshot

type TweetScreenshot struct {
	TweetId  string `json:"tweetId"`
	Username string `json:"username"`
	URL      string `json:"url"`
}

type TwitterAPI

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

Twitter API

func CreateTwitterAPI

func CreateTwitterAPI(l core.ILogger, t core.ITask) *TwitterAPI

CreateTwitterAPI is a default Twitter factory

type TwitterApiCredentials

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

type TwitterMediaFactory

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

func CreateTwitterMediaFactory

func CreateTwitterMediaFactory(l core.ILogger, t core.ITask) *TwitterMediaFactory

func (*TwitterMediaFactory) CreateMedia

func (tmf *TwitterMediaFactory) CreateMedia(tweetID string) ([]*core.Media, error)

CreateMedia is a core.IMediaFactory interface implementation

type URL

type URL struct {
	ExpandedURL string `json:"expanded_url"`
}

URL ...

type User

type User struct {
	Name       string `json:"name"`
	ScreenName string `json:"screen_name"`
}

User ...

type VideoInfo

type VideoInfo struct {
	Duration uint               `json:"duration_millis"`
	Variants []VideoInfoVariant `json:"variants"`
}

VideoInfo ...

type VideoInfoVariant

type VideoInfoVariant struct {
	Bitrate     int    `json:"bitrate"`
	ContentType string `json:"content_type"`
	URL         string `json:"url"`
}

VideoInfoVariant ...

type VpnKey

type VpnKey struct {
	ID        string
	Name      string
	Password  string
	Port      int
	Method    string
	AccessURL string
}

type YoutubeApi

type YoutubeApi interface {
	// contains filtered or unexported methods
}

func CreateYtDlpApi

func CreateYtDlpApi(l core.ILogger) YoutubeApi

type YoutubeMediaFactory

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

func CreateYoutubeMediaFactory

func CreateYoutubeMediaFactory(l core.ILogger, api YoutubeApi, fd core.IFileDownloader) *YoutubeMediaFactory

func (*YoutubeMediaFactory) CreateMedia

func (y *YoutubeMediaFactory) CreateMedia(url string) ([]*core.Media, error)

CreateMedia is a core.IMediaFactory interface implementation

func (*YoutubeMediaFactory) CreateVideo

func (y *YoutubeMediaFactory) CreateVideo(id string) (*core.Video, error)

CreateVideo is a core.IVideoFactory interface implementation

type YtDlpApi

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

type YtDlpFormat

type YtDlpFormat struct {
	Ext        string `json:"ext"`
	FormatId   string `json:"format_id"`
	Format     string `json:"format"`
	FormatNote string `json:"format_note"`
	Filesize   int64  `json:"filesize,omitempty"`
	Height     int    `json:"height"`
	Width      int    `json:"width"`
	Acodec     string `json:"acodec"`
	Vcodec     string `json:"vcodec"`
	Url        string `json:"url"`
}

type YtDlpResponse

type YtDlpResponse struct {
	Id           string         `json:"id"`
	Title        string         `json:"title"`
	Description  string         `json:"description"`
	Creator      string         `json:"creator,omitempty"` // tiktok
	Track        string         `json:"track,omitempty"`   // tiktok
	Artist       string         `json:"artist,omitempty"`  // tiktok
	Duration     float64        `json:"duration"`
	ExtractorKey string         `json:"extractor_key"`
	Thumbnail    string         `json:"thumbnail"`
	Uploader     string         `json:"uploader"`
	Url          string         `json:"url,omitempty"`
	Formats      []*YtDlpFormat `json:"formats"`
}

Jump to

Keyboard shortcuts

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