twitter

package
v0.0.0-...-04ff805 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

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

func New

func New(consumerKey, consumerSecret, accessToken, accessTokenSecret string, proxyUrl string) (*Api, error)

func (*Api) GetLastTweet

func (a *Api) GetLastTweet(uid int64) (*SimpleTweet, error)

func (*Api) GetMentions

func (a *Api) GetMentions(tweetId int64, timeout *time.Duration) (*SimpleTweet, error)

func (*Api) GetTweet

func (a *Api) GetTweet(tweetId int64, timeout *time.Duration) (*SimpleTweet, error)

func (*Api) GetTweets

func (a *Api) GetTweets(userId int64, maxCount int64, sinceId *int64, timeout *time.Duration) ([]SimpleTweet, error)

func (*Api) GetTweetsSinceTime

func (a *Api) GetTweetsSinceTime(uid int64, sinceTime time.Time, timeout *time.Duration) ([]SimpleTweet, error)

func (*Api) GetUserById

func (a *Api) GetUserById(userId int64) (*SimpleUser, error)

func (*Api) GetUserByUsername

func (a *Api) GetUserByUsername(username string) (*SimpleUser, error)

username is @username, NOT nickname(showname)

func (*Api) RateLimit

func (a *Api) RateLimit() time.Duration

type SimpleTweet

type SimpleTweet struct {
	Id              int64  // Tweet Id
	UserName        string // For generate tweet url
	FullText        string
	UserId          int64
	Time            time.Time
	PhotoUrls       []string
	AnimatedGifUrls []string
	VideoUrls       []string
	ReTweetCount    int
	FavoriteCount   int
	CommentCount    int
}

func (*SimpleTweet) GetCleanText

func (t *SimpleTweet) GetCleanText() string

去除末尾大量的不构成语句组成部分的 @... #... example: https://twitter.com/H_O_L_O_/status/1046193782033731584/photo/1 https://twitter.com/H_O_L_O_/status/1045495983126327297

func (*SimpleTweet) GetTextWithoutAtHashtag

func (t *SimpleTweet) GetTextWithoutAtHashtag() string

Removes hashtags and @s from tweet, preserves content after # character. Reference: https://github.com/Conorbro/twitter-sentiment-analysis/blob/master/utils.go

func (*SimpleTweet) GetUrl

func (t *SimpleTweet) GetUrl() string

type SimpleUser

type SimpleUser struct {
	Id             int64  // Global unique int64 id given by twitter, user can't modify it
	UserName       string // Global unique string user name in whole twitter site, users can modify it
	DisplayName    string // Display name whatever user likes
	FollowersCount int
	FollowingCount int
	TweetsCount    int
	JoinedTime     time.Time
	Birthday       time.Time
	Location       string
	Lang           langdetect.Language
	Timezone       time.Location
}

type Url

type Url struct {
	Type     UrlType
	Username string
	TweetId  int64
}

func ParseUrl

func ParseUrl(url string) (*Url, error)

user,tweet

type UrlType

type UrlType string
var (
	UrlTypeUnknown UrlType = ""
	UrlTypeHome    UrlType = "home"
	UrlTypeUser    UrlType = "user"
	UrlTypeTweet   UrlType = "tweet"
)

Jump to

Keyboard shortcuts

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