Class: XTwitterScraper::Resources::X::Users

Inherits:
Object
  • Object
show all
Defined in:
lib/x_twitter_scraper/resources/x/users.rb,
lib/x_twitter_scraper/resources/x/users/follow.rb,
sig/x_twitter_scraper/resources/x/users.rbs,
sig/x_twitter_scraper/resources/x/users/follow.rbs

Defined Under Namespace

Classes: Follow

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Users

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Users.

Parameters:



760
761
762
763
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 760

def initialize(client:)
  @client = client
  @follow = XTwitterScraper::Resources::X::Users::Follow.new(client: client)
end

Instance Attribute Details

#followXTwitterScraper::Resources::X::Users::Follow (readonly)

X write actions (tweets, likes, follows, DMs)



13
14
15
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 13

def follow
  @follow
end

Instance Method Details

#remove_follower(id, account:, idempotency_key:, request_options: {}) ⇒ XTwitterScraper::Models::X::UserRemoveFollowerResponse

Some parameter documentations has been truncated, see Models::X::UserRemoveFollowerParams for more details.

Remove follower

Parameters:

  • id (String)

    Path param: User ID to remove from your followers

  • account (String)

    Body param: X account identifier (@username or account ID)

  • idempotency_key (String)

    Header param: Generate one unique value for each intended write. Reuse it only w

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 53

def remove_follower(id, params)
  parsed, options = XTwitterScraper::X::UserRemoveFollowerParams.dump_request(params)
  header_params = {idempotency_key: "idempotency-key"}
  @client.request(
    method: :post,
    path: ["x/users/%1$s/remove-follower", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: XTwitterScraper::Models::X::UserRemoveFollowerResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ XTwitterScraper::Models::UserProfile

Get user profile with follower counts & verification

Parameters:

Returns:

See Also:



26
27
28
29
30
31
32
33
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 26

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["x/users/%1$s", id],
    model: XTwitterScraper::UserProfile,
    options: params[:request_options]
  )
end

#retrieve_batch(ids:, request_options: {}) ⇒ XTwitterScraper::Models::X::UserRetrieveBatchResponse

Some parameter documentations has been truncated, see Models::X::UserRetrieveBatchParams for more details.

Look up multiple users by IDs in one call

Parameters:

  • ids (String)

    Comma-separated numeric user IDs (1-100 values). Duplicate IDs are ignored while

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 80

def retrieve_batch(params)
  parsed, options = XTwitterScraper::X::UserRetrieveBatchParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "x/users/batch",
    query: query,
    model: XTwitterScraper::Models::X::UserRetrieveBatchResponse,
    options: options
  )
end

#retrieve_followers(id, after: nil, cursor: nil, limit: nil, page_size: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedUsers

Some parameter documentations has been truncated, see Models::X::UserRetrieveFollowersParams for more details.

List followers of a user

Parameters:

  • id (String)

    Target user ID or username for follower lookup.

  • after (String)

    Legacy cursor alias. Prefer cursor.

  • cursor (String)

    Pagination cursor for followers list

  • limit (Integer)

    Legacy integer page size alias for following lists. Prefer pageSize.

  • page_size (Integer)

    Maximum user profiles requested from this page (20-200, default 200). The respon

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



114
115
116
117
118
119
120
121
122
123
124
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 114

def retrieve_followers(id, params = {})
  parsed, options = XTwitterScraper::X::UserRetrieveFollowersParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/users/%1$s/followers", id],
    query: query.transform_keys(page_size: "pageSize"),
    model: XTwitterScraper::PaginatedUsers,
    options: options
  )
end

#retrieve_followers_you_know(id, cursor: nil, page_size: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedUsers

Some parameter documentations has been truncated, see Models::X::UserRetrieveFollowersYouKnowParams for more details.

List mutual followers between you and a user

Parameters:

  • id (String)

    User ID for followers-you-know lookup

  • cursor (String)

    Pagination cursor for followers-you-know

  • page_size (Integer)

    Maximum user profiles requested from this page (20-200, default 200). The respon

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



145
146
147
148
149
150
151
152
153
154
155
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 145

def retrieve_followers_you_know(id, params = {})
  parsed, options = XTwitterScraper::X::UserRetrieveFollowersYouKnowParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/users/%1$s/followers-you-know", id],
    query: query.transform_keys(page_size: "pageSize"),
    model: XTwitterScraper::PaginatedUsers,
    options: options
  )
end

#retrieve_following(id, after: nil, cursor: nil, limit: nil, page_size: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedUsers

Some parameter documentations has been truncated, see Models::X::UserRetrieveFollowingParams for more details.

List accounts a user follows

Parameters:

  • id (String)

    User ID or username for following lookup

  • after (String)

    Deprecated following cursor alias. Prefer cursor.

  • cursor (String)

    Pagination cursor for following list

  • limit (Integer)

    Legacy page size alias. Prefer pageSize.

  • page_size (Integer)

    Maximum user profiles requested from this page (20-200, default 200). The respon

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



179
180
181
182
183
184
185
186
187
188
189
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 179

def retrieve_following(id, params = {})
  parsed, options = XTwitterScraper::X::UserRetrieveFollowingParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/users/%1$s/following", id],
    query: query.transform_keys(page_size: "pageSize"),
    model: XTwitterScraper::PaginatedUsers,
    options: options
  )
end

#retrieve_likes(id, any_words: nil, cashtags: nil, conversation_id: nil, cursor: nil, exact_phrase: nil, exclude_words: nil, from_user: nil, hashtags: nil, in_reply_to_tweet_id: nil, language: nil, media_type: nil, mentioning: nil, min_faves: nil, min_quotes: nil, min_replies: nil, min_retweets: nil, page_size: nil, quotes: nil, quotes_of_tweet_id: nil, replies: nil, retweets: nil, retweets_of_tweet_id: nil, since_date: nil, to_user: nil, until_date: nil, url: nil, verified_only: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedTweets

Some parameter documentations has been truncated, see Models::X::UserRetrieveLikesParams for more details.

List tweets liked by a user

Parameters:

  • id (String)

    User ID or username

  • any_words (String)

    Words or quoted phrases where any one can match. Separate with spaces, commas, o

  • cashtags (String)

    Cashtags separated by spaces, commas, or lines.

  • conversation_id (String)

    Conversation ID filter.

  • cursor (String)

    Pagination cursor for liked tweets

  • exact_phrase (String)

    Exact phrase to match.

  • exclude_words (String)

    Words or quoted phrases to exclude. Separate with spaces, commas, or lines.

  • from_user (String)

    Filter by author username.

  • hashtags (String)

    Hashtags separated by spaces, commas, or lines.

  • in_reply_to_tweet_id (String)

    Only replies to this tweet ID.

  • language (String)

    Language code filter, e.g. en or tr.

  • media_type (Symbol, XTwitterScraper::Models::X::UserRetrieveLikesParams::MediaType)

    Filter by media type.

  • mentioning (String)

    Filter tweets mentioning a username.

  • min_faves (Integer)

    Minimum likes threshold.

  • min_quotes (Integer)

    Minimum quote count threshold.

  • min_replies (Integer)

    Minimum replies threshold.

  • min_retweets (Integer)

    Minimum retweets threshold.

  • page_size (Integer)

    Maximum items requested from this page (1-100, default 20). The response can con

  • quotes (Symbol, XTwitterScraper::Models::X::UserRetrieveLikesParams::Quotes)

    Quote mode.

  • quotes_of_tweet_id (String)

    Only quotes of this tweet ID.

  • replies (Symbol, XTwitterScraper::Models::X::UserRetrieveLikesParams::Replies)

    Reply mode.

  • retweets (Symbol, XTwitterScraper::Models::X::UserRetrieveLikesParams::Retweets)

    Retweet mode.

  • retweets_of_tweet_id (String)

    Only retweets of this tweet ID.

  • since_date (Date)

    Start date in YYYY-MM-DD format.

  • to_user (String)

    Filter replies sent to a username.

  • until_date (Date)

    End date in YYYY-MM-DD format.

  • url (String)

    URL substring or domain filter.

  • verified_only (Boolean)

    Only return tweets from verified authors.

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 259

def retrieve_likes(id, params = {})
  parsed, options = XTwitterScraper::X::UserRetrieveLikesParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/users/%1$s/likes", id],
    query: query.transform_keys(
      any_words: "anyWords",
      conversation_id: "conversationId",
      exact_phrase: "exactPhrase",
      exclude_words: "excludeWords",
      from_user: "fromUser",
      in_reply_to_tweet_id: "inReplyToTweetId",
      media_type: "mediaType",
      min_faves: "minFaves",
      min_quotes: "minQuotes",
      min_replies: "minReplies",
      min_retweets: "minRetweets",
      page_size: "pageSize",
      quotes_of_tweet_id: "quotesOfTweetId",
      retweets_of_tweet_id: "retweetsOfTweetId",
      since_date: "sinceDate",
      to_user: "toUser",
      until_date: "untilDate",
      verified_only: "verifiedOnly"
    ),
    model: XTwitterScraper::PaginatedTweets,
    options: options
  )
end

#retrieve_media(id, any_words: nil, cashtags: nil, conversation_id: nil, cursor: nil, exact_phrase: nil, exclude_words: nil, from_user: nil, hashtags: nil, in_reply_to_tweet_id: nil, language: nil, media_type: nil, mentioning: nil, min_faves: nil, min_quotes: nil, min_replies: nil, min_retweets: nil, page_size: nil, quotes: nil, quotes_of_tweet_id: nil, replies: nil, retweets: nil, retweets_of_tweet_id: nil, since_date: nil, to_user: nil, until_date: nil, url: nil, verified_only: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedTweets

Some parameter documentations has been truncated, see Models::X::UserRetrieveMediaParams for more details.

List media tweets posted by a user

Parameters:

  • id (String)

    User ID or username for media lookup

  • any_words (String)

    Words or quoted phrases where any one can match. Separate with spaces, commas, o

  • cashtags (String)

    Cashtags separated by spaces, commas, or lines.

  • conversation_id (String)

    Conversation ID filter.

  • cursor (String)

    Pagination cursor for media tweets

  • exact_phrase (String)

    Exact phrase to match.

  • exclude_words (String)

    Words or quoted phrases to exclude. Separate with spaces, commas, or lines.

  • from_user (String)

    Filter by author username.

  • hashtags (String)

    Hashtags separated by spaces, commas, or lines.

  • in_reply_to_tweet_id (String)

    Only replies to this tweet ID.

  • language (String)

    Language code filter, e.g. en or tr.

  • media_type (Symbol, XTwitterScraper::Models::X::UserRetrieveMediaParams::MediaType)

    Filter by media type.

  • mentioning (String)

    Filter tweets mentioning a username.

  • min_faves (Integer)

    Minimum likes threshold.

  • min_quotes (Integer)

    Minimum quote count threshold.

  • min_replies (Integer)

    Minimum replies threshold.

  • min_retweets (Integer)

    Minimum retweets threshold.

  • page_size (Integer)

    Maximum items requested from this page (1-100, default 20). The response can con

  • quotes (Symbol, XTwitterScraper::Models::X::UserRetrieveMediaParams::Quotes)

    Quote mode.

  • quotes_of_tweet_id (String)

    Only quotes of this tweet ID.

  • replies (Symbol, XTwitterScraper::Models::X::UserRetrieveMediaParams::Replies)

    Reply mode.

  • retweets (Symbol, XTwitterScraper::Models::X::UserRetrieveMediaParams::Retweets)

    Retweet mode.

  • retweets_of_tweet_id (String)

    Only retweets of this tweet ID.

  • since_date (Date)

    Start date in YYYY-MM-DD format.

  • to_user (String)

    Filter replies sent to a username.

  • until_date (Date)

    End date in YYYY-MM-DD format.

  • url (String)

    URL substring or domain filter.

  • verified_only (Boolean)

    Only return tweets from verified authors.

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 358

def retrieve_media(id, params = {})
  parsed, options = XTwitterScraper::X::UserRetrieveMediaParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/users/%1$s/media", id],
    query: query.transform_keys(
      any_words: "anyWords",
      conversation_id: "conversationId",
      exact_phrase: "exactPhrase",
      exclude_words: "excludeWords",
      from_user: "fromUser",
      in_reply_to_tweet_id: "inReplyToTweetId",
      media_type: "mediaType",
      min_faves: "minFaves",
      min_quotes: "minQuotes",
      min_replies: "minReplies",
      min_retweets: "minRetweets",
      page_size: "pageSize",
      quotes_of_tweet_id: "quotesOfTweetId",
      retweets_of_tweet_id: "retweetsOfTweetId",
      since_date: "sinceDate",
      to_user: "toUser",
      until_date: "untilDate",
      verified_only: "verifiedOnly"
    ),
    model: XTwitterScraper::PaginatedTweets,
    options: options
  )
end

#retrieve_mentions(id, any_words: nil, cashtags: nil, conversation_id: nil, cursor: nil, exact_phrase: nil, exclude_words: nil, from_user: nil, hashtags: nil, in_reply_to_tweet_id: nil, language: nil, media_type: nil, mentioning: nil, min_faves: nil, min_quotes: nil, min_replies: nil, min_retweets: nil, page_size: nil, quotes: nil, quotes_of_tweet_id: nil, replies: nil, retweets: nil, retweets_of_tweet_id: nil, since_date: nil, since_time: nil, to_user: nil, until_date: nil, until_time: nil, url: nil, verified_only: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedTweets

Some parameter documentations has been truncated, see Models::X::UserRetrieveMentionsParams for more details.

List tweets mentioning a user

Parameters:

  • id (String)

    User ID or username for mentions lookup

  • any_words (String)

    Words or quoted phrases where any one can match. Separate with spaces, commas, o

  • cashtags (String)

    Cashtags separated by spaces, commas, or lines.

  • conversation_id (String)

    Conversation ID filter.

  • cursor (String)

    Pagination cursor for mentions

  • exact_phrase (String)

    Exact phrase to match.

  • exclude_words (String)

    Words or quoted phrases to exclude. Separate with spaces, commas, or lines.

  • from_user (String)

    Filter by author username.

  • hashtags (String)

    Hashtags separated by spaces, commas, or lines.

  • in_reply_to_tweet_id (String)

    Only replies to this tweet ID.

  • language (String)

    Language code filter, e.g. en or tr.

  • media_type (Symbol, XTwitterScraper::Models::X::UserRetrieveMentionsParams::MediaType)

    Filter by media type.

  • mentioning (String)

    Filter tweets mentioning a username.

  • min_faves (Integer)

    Minimum likes threshold.

  • min_quotes (Integer)

    Minimum quote count threshold.

  • min_replies (Integer)

    Minimum replies threshold.

  • min_retweets (Integer)

    Minimum retweets threshold.

  • page_size (Integer)

    Maximum items requested from this page (1-100, default 20). The response can con

  • quotes (Symbol, XTwitterScraper::Models::X::UserRetrieveMentionsParams::Quotes)

    Quote mode.

  • quotes_of_tweet_id (String)

    Only quotes of this tweet ID.

  • replies (Symbol, XTwitterScraper::Models::X::UserRetrieveMentionsParams::Replies)

    Reply mode.

  • retweets (Symbol, XTwitterScraper::Models::X::UserRetrieveMentionsParams::Retweets)

    Retweet mode.

  • retweets_of_tweet_id (String)

    Only retweets of this tweet ID.

  • since_date (Date)

    Start date in YYYY-MM-DD format.

  • since_time (String)

    Unix timestamp - return mentions after this time

  • to_user (String)

    Filter replies sent to a username.

  • until_date (Date)

    End date in YYYY-MM-DD format.

  • until_time (String)

    Unix timestamp - return mentions before this time

  • url (String)

    URL substring or domain filter.

  • verified_only (Boolean)

    Only return tweets from verified authors.

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 461

def retrieve_mentions(id, params = {})
  parsed, options = XTwitterScraper::X::UserRetrieveMentionsParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/users/%1$s/mentions", id],
    query: query.transform_keys(
      any_words: "anyWords",
      conversation_id: "conversationId",
      exact_phrase: "exactPhrase",
      exclude_words: "excludeWords",
      from_user: "fromUser",
      in_reply_to_tweet_id: "inReplyToTweetId",
      media_type: "mediaType",
      min_faves: "minFaves",
      min_quotes: "minQuotes",
      min_replies: "minReplies",
      min_retweets: "minRetweets",
      page_size: "pageSize",
      quotes_of_tweet_id: "quotesOfTweetId",
      retweets_of_tweet_id: "retweetsOfTweetId",
      since_date: "sinceDate",
      since_time: "sinceTime",
      to_user: "toUser",
      until_date: "untilDate",
      until_time: "untilTime",
      verified_only: "verifiedOnly"
    ),
    model: XTwitterScraper::PaginatedTweets,
    options: options
  )
end

#retrieve_replies(id, any_words: nil, cashtags: nil, conversation_id: nil, cursor: nil, exact_phrase: nil, exclude_words: nil, from_user: nil, hashtags: nil, include_parent_tweet: nil, in_reply_to_tweet_id: nil, language: nil, media_type: nil, mentioning: nil, min_faves: nil, min_quotes: nil, min_replies: nil, min_retweets: nil, page_size: nil, quotes: nil, quotes_of_tweet_id: nil, replies: nil, retweets: nil, retweets_of_tweet_id: nil, since_date: nil, to_user: nil, until_date: nil, url: nil, verified_only: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedTweets

Some parameter documentations has been truncated, see Models::X::UserRetrieveRepliesParams for more details.

Returns the user's timeline with replies included by default.

Parameters:

  • id (String)

    Target user ID or username for the replies timeline.

  • any_words (String)

    Words or quoted phrases where any one can match. Separate with spaces, commas, o

  • cashtags (String)

    Cashtags separated by spaces, commas, or lines.

  • conversation_id (String)

    Conversation ID filter.

  • cursor (String)

    Pagination cursor for user replies

  • exact_phrase (String)

    Exact phrase to match.

  • exclude_words (String)

    Words or quoted phrases to exclude. Separate with spaces, commas, or lines.

  • from_user (String)

    Filter by author username.

  • hashtags (String)

    Hashtags separated by spaces, commas, or lines.

  • include_parent_tweet (Boolean)

    Include each reply's parent tweet.

  • in_reply_to_tweet_id (String)

    Only replies to this tweet ID.

  • language (String)

    Language code filter, e.g. en or tr.

  • media_type (Symbol, XTwitterScraper::Models::X::UserRetrieveRepliesParams::MediaType)

    Filter by media type.

  • mentioning (String)

    Filter tweets mentioning a username.

  • min_faves (Integer)

    Minimum likes threshold.

  • min_quotes (Integer)

    Minimum quote count threshold.

  • min_replies (Integer)

    Minimum replies threshold.

  • min_retweets (Integer)

    Minimum retweets threshold.

  • page_size (Integer)

    Maximum items requested from this page (1-100, default 20). The response can con

  • quotes (Symbol, XTwitterScraper::Models::X::UserRetrieveRepliesParams::Quotes)

    Quote mode.

  • quotes_of_tweet_id (String)

    Only quotes of this tweet ID.

  • replies (Symbol, XTwitterScraper::Models::X::UserRetrieveRepliesParams::Replies)

    Reply mode.

  • retweets (Symbol, XTwitterScraper::Models::X::UserRetrieveRepliesParams::Retweets)

    Retweet mode.

  • retweets_of_tweet_id (String)

    Only retweets of this tweet ID.

  • since_date (Date)

    Start date in YYYY-MM-DD format.

  • to_user (String)

    Filter replies sent to a username.

  • until_date (Date)

    End date in YYYY-MM-DD format.

  • url (String)

    URL substring or domain filter.

  • verified_only (Boolean)

    Only return tweets from verified authors.

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 564

def retrieve_replies(id, params = {})
  parsed, options = XTwitterScraper::X::UserRetrieveRepliesParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/users/%1$s/replies", id],
    query: query.transform_keys(
      any_words: "anyWords",
      conversation_id: "conversationId",
      exact_phrase: "exactPhrase",
      exclude_words: "excludeWords",
      from_user: "fromUser",
      include_parent_tweet: "includeParentTweet",
      in_reply_to_tweet_id: "inReplyToTweetId",
      media_type: "mediaType",
      min_faves: "minFaves",
      min_quotes: "minQuotes",
      min_replies: "minReplies",
      min_retweets: "minRetweets",
      page_size: "pageSize",
      quotes_of_tweet_id: "quotesOfTweetId",
      retweets_of_tweet_id: "retweetsOfTweetId",
      since_date: "sinceDate",
      to_user: "toUser",
      until_date: "untilDate",
      verified_only: "verifiedOnly"
    ),
    model: XTwitterScraper::PaginatedTweets,
    options: options
  )
end

#retrieve_search(q:, cursor: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedUsers

Search users by name or username

Parameters:

  • q (String)

    User search query

  • cursor (String)

    Pagination cursor for user search

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



609
610
611
612
613
614
615
616
617
618
619
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 609

def retrieve_search(params)
  parsed, options = XTwitterScraper::X::UserRetrieveSearchParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "x/users/search",
    query: query,
    model: XTwitterScraper::PaginatedUsers,
    options: options
  )
end

#retrieve_tweets(id, any_words: nil, cashtags: nil, conversation_id: nil, cursor: nil, exact_phrase: nil, exclude_words: nil, from_user: nil, hashtags: nil, include_parent_tweet: nil, include_replies: nil, in_reply_to_tweet_id: nil, language: nil, media_type: nil, mentioning: nil, min_faves: nil, min_quotes: nil, min_replies: nil, min_retweets: nil, page_size: nil, quotes: nil, quotes_of_tweet_id: nil, replies: nil, retweets: nil, retweets_of_tweet_id: nil, since_date: nil, to_user: nil, until_date: nil, url: nil, verified_only: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedTweets

Some parameter documentations has been truncated, see Models::X::UserRetrieveTweetsParams for more details.

List recent tweets posted by a user

Parameters:

  • id (String)

    X user ID or username

  • any_words (String)

    Words or quoted phrases where any one can match. Separate with spaces, commas, o

  • cashtags (String)

    Cashtags separated by spaces, commas, or lines.

  • conversation_id (String)

    Conversation ID filter.

  • cursor (String)

    Pagination cursor for user tweets

  • exact_phrase (String)

    Exact phrase to match.

  • exclude_words (String)

    Words or quoted phrases to exclude. Separate with spaces, commas, or lines.

  • from_user (String)

    Filter by author username.

  • hashtags (String)

    Hashtags separated by spaces, commas, or lines.

  • include_parent_tweet (Boolean)

    Include parent tweet for replies

  • include_replies (Boolean)

    Include reply tweets

  • in_reply_to_tweet_id (String)

    Only replies to this tweet ID.

  • language (String)

    Language code filter, e.g. en or tr.

  • media_type (Symbol, XTwitterScraper::Models::X::UserRetrieveTweetsParams::MediaType)

    Filter by media type.

  • mentioning (String)

    Filter tweets mentioning a username.

  • min_faves (Integer)

    Minimum likes threshold.

  • min_quotes (Integer)

    Minimum quote count threshold.

  • min_replies (Integer)

    Minimum replies threshold.

  • min_retweets (Integer)

    Minimum retweets threshold.

  • page_size (Integer)

    Maximum items requested from this page (1-100, default 20). The response can con

  • quotes (Symbol, XTwitterScraper::Models::X::UserRetrieveTweetsParams::Quotes)

    Quote mode.

  • quotes_of_tweet_id (String)

    Only quotes of this tweet ID.

  • replies (Symbol, XTwitterScraper::Models::X::UserRetrieveTweetsParams::Replies)

    Reply mode.

  • retweets (Symbol, XTwitterScraper::Models::X::UserRetrieveTweetsParams::Retweets)

    Retweet mode.

  • retweets_of_tweet_id (String)

    Only retweets of this tweet ID.

  • since_date (Date)

    Start date in YYYY-MM-DD format.

  • to_user (String)

    Filter replies sent to a username.

  • until_date (Date)

    End date in YYYY-MM-DD format.

  • url (String)

    URL substring or domain filter.

  • verified_only (Boolean)

    Only return tweets from verified authors.

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 693

def retrieve_tweets(id, params = {})
  parsed, options = XTwitterScraper::X::UserRetrieveTweetsParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/users/%1$s/tweets", id],
    query: query.transform_keys(
      any_words: "anyWords",
      conversation_id: "conversationId",
      exact_phrase: "exactPhrase",
      exclude_words: "excludeWords",
      from_user: "fromUser",
      include_parent_tweet: "includeParentTweet",
      include_replies: "includeReplies",
      in_reply_to_tweet_id: "inReplyToTweetId",
      media_type: "mediaType",
      min_faves: "minFaves",
      min_quotes: "minQuotes",
      min_replies: "minReplies",
      min_retweets: "minRetweets",
      page_size: "pageSize",
      quotes_of_tweet_id: "quotesOfTweetId",
      retweets_of_tweet_id: "retweetsOfTweetId",
      since_date: "sinceDate",
      to_user: "toUser",
      until_date: "untilDate",
      verified_only: "verifiedOnly"
    ),
    model: XTwitterScraper::PaginatedTweets,
    options: options
  )
end

#retrieve_verified_followers(id, cursor: nil, page_size: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedUsers

Some parameter documentations has been truncated, see Models::X::UserRetrieveVerifiedFollowersParams for more details.

List verified followers of a user

Parameters:

  • id (String)

    User ID or username for verified followers

  • cursor (String)

    Pagination cursor for verified followers

  • page_size (Integer)

    Maximum user profiles requested from this page (20-200, default 200). The respon

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



745
746
747
748
749
750
751
752
753
754
755
# File 'lib/x_twitter_scraper/resources/x/users.rb', line 745

def retrieve_verified_followers(id, params = {})
  parsed, options = XTwitterScraper::X::UserRetrieveVerifiedFollowersParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/users/%1$s/verified-followers", id],
    query: query.transform_keys(page_size: "pageSize"),
    model: XTwitterScraper::PaginatedUsers,
    options: options
  )
end