twitter

package
v0.0.8-beta Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLoggedIn

func IsLoggedIn(scraper *twitterscraper.Scraper) bool

func LoadCookies

func LoadCookies(scraper *twitterscraper.Scraper, filePath string) error

func Login

func Login(scraper *twitterscraper.Scraper, credentials ...string) error

Login attempts to log in to the Twitter scraper service. It supports three modes of operation: 1. Basic login using just a username and password. 2. Login requiring an email confirmation, using a username, password, and email address. 3. Login with two-factor authentication, using a username, password, and 2FA code. Parameters:

  • scraper: A pointer to an instance of the twitterscraper.Scraper.
  • credentials: A variadic list of strings representing login credentials. The function expects either two strings (username, password) for basic login, or three strings (username, password, email/2FA code) for email confirmation or 2FA.

Returns an error if login fails or if an invalid number of credentials is provided.

func Logout

func Logout(scraper *twitterscraper.Scraper) error

func SaveCookies

func SaveCookies(scraper *twitterscraper.Scraper, filePath string) error

func ScrapeFollowersForProfile

func ScrapeFollowersForProfile(username string, count int) ([]twitterscraper.Legacy, error)

ScrapeFollowersForProfile scrapes the profile and tweets of a specific Twitter user. It takes the username as a parameter and returns the scraped profile information and an error if any.

func ScrapeTweetsByQuery

func ScrapeTweetsByQuery(query string, count int) ([]*twitterscraper.Tweet, error)

ScrapeTweetsByQuery performs a search on Twitter for tweets matching the specified query. It fetches up to the specified count of tweets and returns a slice of Tweet pointers. Parameters:

  • query: The search query string to find matching tweets.
  • count: The maximum number of tweets to retrieve.

Returns:

  • A slice of pointers to twitterscraper.Tweet objects that match the search query.
  • An error if the scraping process encounters any issues.

func ScrapeTweetsByTrends

func ScrapeTweetsByTrends() ([]string, error)

ScrapeTweetsByTrends scrapes the current trending topics on Twitter. It returns a slice of strings representing the trending topics. If an error occurs during the scraping process, it returns an error.

func ScrapeTweetsForSentiment

func ScrapeTweetsForSentiment(query string, count int, model string) (string, string, error)

ScrapeTweetsForSentiment is a function that scrapes tweets based on a given query, analyzes their sentiment using a specified model, and returns the sentiment analysis results. Parameters:

  • query: The search query string to find matching tweets.
  • count: The maximum number of tweets to retrieve and analyze.
  • model: The model to use for sentiment analysis.

Returns:

  • A string representing the sentiment analysis prompt.
  • A string representing the sentiment analysis result.
  • An error if the scraping or sentiment analysis process encounters any issues.

func ScrapeTweetsProfile

func ScrapeTweetsProfile(username string) (twitterscraper.Profile, error)

ScrapeTweetsProfile scrapes the profile and tweets of a specific Twitter user. It takes the username as a parameter and returns the scraped profile information and an error if any.

Types

This section is empty.

Jump to

Keyboard shortcuts

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