scraper

package
v0.0.0-...-1912285 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Feed selectors
	FeedContainer = `[data-testid="primaryColumn"]`
	TweetArticle  = `article[data-testid="tweet"]`

	// Tweet content selectors
	TweetText      = `[data-testid="tweetText"]`
	TweetShowMore  = `button[data-testid="tweet-text-show-more-link"]`
	TweetAuthor    = `[data-testid="User-Name"]`
	TweetTimestamp = `time`
	TweetLink      = `a[href*="/status/"]`
	TweetMedia     = `[data-testid="tweetPhoto"], [data-testid="videoPlayer"]`

	// Engagement selectors
	ReplyCount   = `[data-testid="reply"]`
	RetweetCount = `[data-testid="retweet"]`
	LikeCount    = `[data-testid="like"]`

	// Tweet type indicators
	RetweetIndicator = `[data-testid="socialContext"]`
	QuoteIndicator   = `[data-testid="quoteTweet"]`
	ReplyIndicator   = `[data-testid="tweet"] a[href*="/status/"][dir="ltr"]`

	// Login page indicators (for detecting auth state)
	HomeIndicator = `[data-testid="SideNav_NewTweet_Button"]`
	LoginForm     = `[data-testid="loginButton"]`
)
View Source
const (
	WaitForTweets = TweetArticle
)

Common wait conditions

Variables

This section is empty.

Functions

This section is empty.

Types

type Scraper

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

Scraper handles extracting posts from X.com

func New

func New(headless bool, debugPauseAfterScrape bool) *Scraper

New creates a new scraper

func (*Scraper) ScrapeForYou

func (s *Scraper) ScrapeForYou(ctx context.Context, cookies []*network.Cookie, count int) ([]types.Post, error)

ScrapeForYou fetches posts from the For You feed

Jump to

Keyboard shortcuts

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