twitter

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RateLimitDuration = 15 * time.Minute
)

Variables

This section is empty.

Functions

func AttemptLoginForUsername added in v0.8.9

func AttemptLoginForUsername(username string) error

func GetRateLimitDuration added in v0.8.2

func GetRateLimitDuration() time.Duration

func LoadCookies

func LoadCookies(scraper *twitterscraper.Scraper, account *TwitterAccount, baseDir string) error

func RandomSleep added in v0.8.4

func RandomSleep()

func SaveCookies

func SaveCookies(scraper *twitterscraper.Scraper, account *TwitterAccount, baseDir string) error

func ScrapeFollowersForProfile

func ScrapeFollowersForProfile(username string, count int) ([]*twitterscraper.Profile, *data_types.LoginEvent, error)

func ScrapeTweetByID added in v0.8.9

func ScrapeTweetByID(id string) (*twitterscraper.Tweet, *data_types.LoginEvent, error)

func ScrapeTweetsProfile

func ScrapeTweetsProfile(username string) (twitterscraper.Profile, *data_types.LoginEvent, error)

Types

type AccountState added in v0.8.9

type AccountState struct {
	Username         string
	IsRateLimited    bool
	RateLimitedUntil time.Time
	LastScraped      time.Time
	LoginStatus      string // e.g., "Successful", "Please verify", "Failed - [Reason]"
}

AccountState holds the state of a Twitter account

type Scraper added in v0.8.2

type Scraper struct {
	*twitterscraper.Scraper
}

func NewScraper added in v0.8.2

func NewScraper(account *TwitterAccount, cookieDir string) (*Scraper, *data_types.LoginEvent)

func (*Scraper) IsLoggedIn added in v0.8.2

func (scraper *Scraper) IsLoggedIn() bool

func (*Scraper) Login added in v0.8.2

func (scraper *Scraper) Login(account *TwitterAccount) error

func (*Scraper) Logout added in v0.8.2

func (scraper *Scraper) Logout() error

type TweetResult added in v0.5.1

type TweetResult struct {
	Tweet *twitterscraper.Tweet
	Error error
}

func ScrapeTweetsByQuery

func ScrapeTweetsByQuery(query string, count int) ([]*TweetResult, *data_types.LoginEvent, error)

type TwitterAccount added in v0.8.2

type TwitterAccount struct {
	Username         string
	Password         string
	TwoFACode        string
	RateLimitedUntil time.Time
	LastScraped      time.Time
	LoginStatus      string
}

type TwitterAccountManager added in v0.8.2

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

func GetAccountManager added in v0.8.9

func GetAccountManager() *TwitterAccountManager

func NewTwitterAccountManager added in v0.8.2

func NewTwitterAccountManager(accounts []*TwitterAccount) *TwitterAccountManager

func (*TwitterAccountManager) GetAccountByUsername added in v0.8.9

func (manager *TwitterAccountManager) GetAccountByUsername(username string) *TwitterAccount

func (*TwitterAccountManager) GetAccountStates added in v0.8.9

func (manager *TwitterAccountManager) GetAccountStates() []AccountState

GetAccountStates returns the state of all Twitter accounts

func (*TwitterAccountManager) GetNextAccount added in v0.8.2

func (manager *TwitterAccountManager) GetNextAccount() *TwitterAccount

func (*TwitterAccountManager) MarkAccountRateLimited added in v0.8.2

func (manager *TwitterAccountManager) MarkAccountRateLimited(account *TwitterAccount)

Jump to

Keyboard shortcuts

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