Documentation
¶
Index ¶
- Variables
- func MockLongTextElement() (*elements.MockWebElement, *elements.MockWebElement, *elements.MockWebElement)
- type Data
- type GetAuthor
- type GetAvatar
- type GetID
- type GetIDFromTweetPage
- type GetImages
- type GetLongText
- type GetQuoteAuthor
- type GetQuoteAvatar
- type GetQuoteImages
- type GetQuoteText
- type GetQuoteTimestamp
- type GetText
- type GetTimestamp
- type GetTweetInformation
- type HasQuote
- type IsAReply
- type IsQuoteAReply
- type OpenAndRetrieveArticleByID
- type Quote
- type RetrieveAll
- type Tweet
Constants ¶
This section is empty.
Variables ¶
var ( FailedToRetrieveArticles = errors.New("failed to retrieve articles") EmptyStateNoArticlesToRetrieve = errors.New("empty state, no articles to retrieve") FailedToRetrieveArticle = errors.New("failed to retrieve article") FailedToObtainTweetAuthorElement = errors.New("failed to obtain tweet author element") FailedToObtainTweetAuthor = errors.New("failed to obtain tweet author") FailedToObtainQuotedTweetAuthorElement = errors.New("failed to obtain quoted tweet author element") FailedToObtainQuotedTweetAuthor = errors.New("failed to obtain quoted tweet author") FailedToObtainTweetAuthorInformation = errors.New("failed to obtain tweet author information") FailedToObtainTweetAvatarElement = errors.New("failed to obtain tweet avatar element") FailedToObtainTweetAvatarImage = errors.New("failed to obtain tweet avatar image") FailedToObtainTweetAvatarSrcFromImage = errors.New("failed to obtain tweet avatar src from image") FailedToObtainQuotedTweetAvatarElement = errors.New("failed to obtain quoted tweet avatar element") FailedToObtainQuotedTweetAvatarImage = errors.New("failed to obtain quoted tweet avatar image") FailedToObtainQuotedTweetAvatarSrcFromImage = errors.New("failed to obtain quoted tweet avatar src from image") FailedToObtainTweetIDElement = errors.New("failed to obtain tweet ID element") FailedToObtainTweetIDATag = errors.New("failed to obtain tweet ID a tag") FailedToObtainTweetIDATagHref = errors.New("failed to obtain tweet ID a tag href") FailedToObtainTweetIDElementFromTweetPageHeader = errors.New("failed to obtain tweet ID from tweet page header") FailedToObtainTweetIDElementFromTweetPage = errors.New("failed to obtain tweet ID from tweet page footer") FailedToObtainTweetTimestampElement = errors.New("failed to obtain tweet timestamp element") FailedToObtainTweetTimestampTimeTag = errors.New("failed to obtain tweet timestamp time tag") FailedToObtainTweetTimestamp = errors.New("failed to obtain tweet timestamp") FailedToObtainQuotedTweetTimestampElement = errors.New("failed to obtain quoted tweet timestamp element") FailedToObtainQuotedTweetTimestampTimeTag = errors.New("failed to obtain quoted tweet timestamp time tag") FailedToObtainQuotedTweetTimestamp = errors.New("failed to obtain quoted tweet timestamp") FailedToObtainTweetTimestampInformation = errors.New("failed to obtain tweet timestamp information") FailedToObtainTweetTextElement = errors.New("failed to obtain tweet text element") FailedToObtainTweetTextParts = errors.New("failed to obtain tweet text parts") FailedToObtainTweetTextPartTagName = errors.New("failed to obtain tweet text part tag name") FailedToObtainTweetTextFromSpan = errors.New("failed to obtain tweet text from span") FailedToLoadTweetPage = errors.New("failed to load tweet page") FailedToObtainTweetLongTextElement = errors.New("failed to obtain tweet long text element") FailedToObtainTweetLongTextParts = errors.New("failed to obtain tweet long text parts") FailedToObtainTweetLongTextPartTagName = errors.New("failed to obtain tweet long text part tag name") FailedToObtainTweetLongTextFromSpan = errors.New("failed to obtain tweet long text from span") FailedToCloseOpenedTabs = errors.New("failed close opened tabs") FailedToObtainQuotedTweetTextElement = errors.New("failed to obtain quoted tweet text element") FailedToObtainQuotedTweetTextParts = errors.New("failed to obtain quoted tweet text parts") FailedToObtainQuotedTweetTextPartTagName = errors.New("failed to obtain quoted tweet text part tag name") FailedToObtainQuotedTweetTextFromSpan = errors.New("failed to obtain quoted tweet text from span") FailedToObtainTweetImagesElement = errors.New("failed to obtain tweet images element") FailedToObtainTweetImages = errors.New("failed to obtain tweet images") FailedToObtainTweetSrcFromImage = errors.New("failed to obtain tweet src from image") FailedToObtainQuotedTweetImagesElement = errors.New("failed to obtain quoted tweet images element") FailedToObtainQuotedTweetImages = errors.New("failed to obtain quoted tweet images") FailedToObtainQuotedTweetSrcFromImage = errors.New("failed to obtain quoted tweet src from image") )
Functions ¶
func MockLongTextElement ¶
func MockLongTextElement() (*elements.MockWebElement, *elements.MockWebElement, *elements.MockWebElement)
MockLongTextElement mocks the tweet Long Text Elements, its dependencies and all the functions that will be executed on them
Types ¶
type Data ¶
type Data struct {
Author string
Avatar string
Timestamp string
IsAReply bool
HasText bool
HasImages bool
Text string
Images []string
}
Data defines the selected parts of a tweets that will be saved
type GetAuthor ¶
GetAuthor retrieves the tweet author
func MockGetAuthor ¶
MockGetAuthor mocks GetAuthor function
type GetAvatar ¶
GetAvatar retrieves the tweet author's avatar
func MockGetAvatar ¶
MockGetAvatar mocks GetAvatar function
type GetIDFromTweetPage ¶
type GetIDFromTweetPage func(ctx context.Context, tweetArticleElement selenium.WebElement) (string, error)
GetIDFromTweetPage retrieves the ID of a tweet from the opened tweet page
func MakeGetIDFromTweetPage ¶
func MakeGetIDFromTweetPage() GetIDFromTweetPage
MakeGetIDFromTweetPage creates a new GetIDFromTweetPage
func MockGetIDFromTweetPage ¶
func MockGetIDFromTweetPage(id string, err error) GetIDFromTweetPage
MockGetIDFromTweetPage mocks GetIDFromTweetPage function
type GetImages ¶
type GetImages func(ctx context.Context, tweetArticleElement selenium.WebElement, isAReply bool) ([]string, error)
GetImages retrieves the tweet images
func MockGetImages ¶
MockGetImages mocks GetImages function
type GetLongText ¶
type GetLongText func(ctx context.Context, tweetElement selenium.WebElement, isAReply bool) (string, error)
GetLongText retrieves the tweet text when it is so long that the Show More link is displayed
func MockGetLongText ¶
func MockGetLongText(text string, err error) GetLongText
MockGetLongText mocks GetLongText function
type GetQuoteAuthor ¶
type GetQuoteAuthor func(ctx context.Context, tweetArticleElement selenium.WebElement, hasTweetOnlyText bool) (string, error)
GetQuoteAuthor retrieves the quoted tweet author
func MakeGetQuoteAuthor ¶
func MakeGetQuoteAuthor() GetQuoteAuthor
MakeGetQuoteAuthor creates a new GetQuoteAuthor
func MockGetQuoteAuthor ¶
func MockGetQuoteAuthor(author string, err error) GetQuoteAuthor
MockGetQuoteAuthor mocks GetQuoteAuthor function
type GetQuoteAvatar ¶
type GetQuoteAvatar func(ctx context.Context, tweetArticleElement selenium.WebElement, hasTweetOnlyText bool) (string, error)
GetQuoteAvatar retrieves the quote author's avatar
func MakeGetQuoteAvatar ¶
func MakeGetQuoteAvatar() GetQuoteAvatar
MakeGetQuoteAvatar creates a new GetQuoteAvatar
func MockGetQuoteAvatar ¶
func MockGetQuoteAvatar(avatar string, err error) GetQuoteAvatar
MockGetQuoteAvatar mocks GetQuoteAvatar function
type GetQuoteImages ¶
type GetQuoteImages func(ctx context.Context, tweetArticleElement selenium.WebElement, isAReply, hasTweetOnlyText bool) ([]string, error)
GetQuoteImages retrieves the quoted tweet images
func MakeGetQuoteImages ¶
func MakeGetQuoteImages() GetQuoteImages
MakeGetQuoteImages creates a new GetQuoteImages
func MockGetQuoteImages ¶
func MockGetQuoteImages(urls []string, err error) GetQuoteImages
MockGetQuoteImages mocks GetQuoteImages function
type GetQuoteText ¶
type GetQuoteText func(ctx context.Context, tweetArticleElement selenium.WebElement, isAReply, hasTweetOnlyText, hasTweetOnlyImages, isQuoteAReply bool) (string, error)
GetQuoteText retrieves the quoted tweet text
func MakeGetQuoteText ¶
func MakeGetQuoteText() GetQuoteText
MakeGetQuoteText creates a new GetQuoteText
func MockGetQuoteText ¶
func MockGetQuoteText(text string, err error) GetQuoteText
MockGetQuoteText mocks GetQuoteText function
type GetQuoteTimestamp ¶
type GetQuoteTimestamp func(ctx context.Context, tweetArticleElement selenium.WebElement, hasTweetOnlyText bool) (string, error)
GetQuoteTimestamp retrieves the quoted tweet timestamp from the datetime attribute of the time element
func MakeGetQuoteTimestamp ¶
func MakeGetQuoteTimestamp() GetQuoteTimestamp
MakeGetQuoteTimestamp creates a new GetQuoteTimestamp
func MockGetQuoteTimestamp ¶
func MockGetQuoteTimestamp(timestamp string, err error) GetQuoteTimestamp
MockGetQuoteTimestamp mocks GetQuoteTimestamp function
type GetText ¶
type GetText func(ctx context.Context, tweetArticleElement selenium.WebElement, isAReply bool) (string, bool, error)
GetText retrieves the tweet text
type GetTimestamp ¶
type GetTimestamp func(ctx context.Context, tweetArticleElement selenium.WebElement) (string, error)
GetTimestamp retrieves the tweet timestamp from the datetime attribute of the time element
func MakeGetTimestamp ¶
func MakeGetTimestamp() GetTimestamp
MakeGetTimestamp creates a new GetTimestamp
func MockGetTimestamp ¶
func MockGetTimestamp(timestamp string, err error) GetTimestamp
MockGetTimestamp mocks GetTimestamp function
type GetTweetInformation ¶
type GetTweetInformation func(ctx context.Context, tweetArticleElement selenium.WebElement, tweetID string) (Tweet, error)
GetTweetInformation retrieves the tweet information from the given tweet element
func MakeGetTweetInformation ¶
func MakeGetTweetInformation(isAReply IsAReply, getAuthor GetAuthor, getTimestamp GetTimestamp, getAvatar GetAvatar, getText GetText, getImages GetImages, hasQuote HasQuote, isQuoteAReply IsQuoteAReply, getQuoteAuthor GetQuoteAuthor, getQuoteAvatar GetQuoteAvatar, getQuoteTimestamp GetQuoteTimestamp, getQuoteText GetQuoteText, getQuoteImages GetQuoteImages, openAndRetrieveTweetArticleByID OpenAndRetrieveArticleByID, getLongText GetLongText, closeOpenedTabs page.CloseOpenedTabs) GetTweetInformation
MakeGetTweetInformation creates a new GetTweetInformation
func MockGetTweetInformation ¶
func MockGetTweetInformation(tweet Tweet, err error) GetTweetInformation
MockGetTweetInformation mocks GetTweetInformation function
type HasQuote ¶
type HasQuote func(tweetArticleElement selenium.WebElement, isAReply, hasTweetOnlyText bool) bool
HasQuote returns a bool indicating if the base tweet is quoting another tweet
type IsAReply ¶
type IsAReply func(tweetArticleElement selenium.WebElement) bool
IsAReply returns a bool indicating if the base tweet is replying to another tweet
type IsQuoteAReply ¶
type IsQuoteAReply func(tweetArticleElement selenium.WebElement, isAReply, hasTweetOnlyText bool) bool
IsQuoteAReply returns a bool indicating if the quoted tweet is replying to another tweet
func MakeIsQuoteAReply ¶
func MakeIsQuoteAReply() IsQuoteAReply
MakeIsQuoteAReply creates a new IsQuoteAReply
func MockIsQuoteAReply ¶
func MockIsQuoteAReply(isQuoteAReply bool) IsQuoteAReply
MockIsQuoteAReply mocks IsQuoteAReply function
type OpenAndRetrieveArticleByID ¶
type OpenAndRetrieveArticleByID func(ctx context.Context, author, id string) (selenium.WebElement, error)
OpenAndRetrieveArticleByID navigates into a specific tweet and retrieves the <article> HTML element associated with it. This allows us to extract the full text of tweets exceeding 280 characters (the limit for free accounts). The function ensures the retrieved <article> corresponds to the provided tweet ID, even if the tweet is part of a thread or accompanied by replies
func MakeOpenAndRetrieveArticleByID ¶
func MakeOpenAndRetrieveArticleByID(openNewTab page.OpenNewTab, waitAndRetrieveElements elements.WaitAndRetrieveAll, getTweetIDFromTweetPage GetIDFromTweetPage) OpenAndRetrieveArticleByID
MakeOpenAndRetrieveArticleByID creates a new OpenAndRetrieveArticleByID
func MockOpenAndRetrieveArticleByID ¶
func MockOpenAndRetrieveArticleByID(element selenium.WebElement, err error) OpenAndRetrieveArticleByID
MockOpenAndRetrieveArticleByID mocks OpenAndRetrieveArticleByID function
type Quote ¶
type Quote struct {
Data
}
Quote contains the information of a retweeted tweet in the original tweet
type RetrieveAll ¶
RetrieveAll retrieves all the tweets from the current page
func MakeRetrieveAll ¶
func MakeRetrieveAll(waitAndRetrieveElement elements.WaitAndRetrieve, waitAndRetrieveElements elements.WaitAndRetrieveAll, getTweetID GetID, getTweetInformation GetTweetInformation, scrollPage page.Scroll) RetrieveAll
MakeRetrieveAll creates a new RetrieveAll
func MockRetrieveAll ¶
func MockRetrieveAll(tweets []Tweet, err error) RetrieveAll
MockRetrieveAll mocks RetrieveAll function