Class: XTwitterScraper::Resources::X::Lists

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

Overview

X List followers, members, and tweets

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Lists

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 Lists.

Parameters:



204
205
206
# File 'lib/x_twitter_scraper/resources/x/lists.rb', line 204

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve_followers(id, bio_contains: nil, cursor: nil, has_location: nil, has_website: nil, location_contains: nil, max_followers: nil, max_following: nil, max_statuses: nil, min_account_age_days: nil, min_followers: nil, min_following: nil, min_statuses: nil, page_size: nil, username_contains: nil, verified_only: nil, verified_type: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedUsers

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

List followers of an X List

Parameters:

  • id (String)

    List ID

  • bio_contains (String)

    Match any comma-separated or line-separated bio term, ignoring case.

  • cursor (String)

    Pagination cursor for list followers

  • has_location (Boolean)

    Only return profiles with a location.

  • has_website (Boolean)

    Only return profiles with a website.

  • location_contains (String)

    Match a location substring, ignoring case.

  • max_followers (Integer)

    Maximum follower count. Missing counts pass this maximum.

  • max_following (Integer)

    Maximum following count.

  • max_statuses (Integer)

    Maximum post count. maxPosts is also accepted.

  • min_account_age_days (Integer)

    Minimum account age in whole days.

  • min_followers (Integer)

    Minimum follower count. Filtering happens before billing.

  • min_following (Integer)

    Minimum following count.

  • min_statuses (Integer)

    Minimum post count. minPosts is also accepted.

  • page_size (Integer)

    Maximum user profiles requested from this page (20-200, default 200). Source, fi

  • username_contains (String)

    Match a username substring, ignoring case.

  • verified_only (Boolean)

    Only return verified profiles.

  • verified_type (String)

    Match the verification type exactly, ignoring case.

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

Returns:

See Also:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/x_twitter_scraper/resources/x/lists.rb', line 58

def retrieve_followers(id, params = {})
  parsed, options = XTwitterScraper::X::ListRetrieveFollowersParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/lists/%1$s/followers", id],
    query: query.transform_keys(
      bio_contains: "bioContains",
      has_location: "hasLocation",
      has_website: "hasWebsite",
      location_contains: "locationContains",
      max_followers: "maxFollowers",
      max_following: "maxFollowing",
      max_statuses: "maxStatuses",
      min_account_age_days: "minAccountAgeDays",
      min_followers: "minFollowers",
      min_following: "minFollowing",
      min_statuses: "minStatuses",
      page_size: "pageSize",
      username_contains: "usernameContains",
      verified_only: "verifiedOnly",
      verified_type: "verifiedType"
    ),
    model: XTwitterScraper::PaginatedUsers,
    options: options
  )
end

#retrieve_members(id, bio_contains: nil, cursor: nil, has_location: nil, has_website: nil, location_contains: nil, max_followers: nil, max_following: nil, max_statuses: nil, min_account_age_days: nil, min_followers: nil, min_following: nil, min_statuses: nil, page_size: nil, username_contains: nil, verified_only: nil, verified_type: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedUsers

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

List members of an X List

Parameters:

  • id (String)

    List ID for member lookup

  • bio_contains (String)

    Match any comma-separated or line-separated bio term, ignoring case.

  • cursor (String)

    Pagination cursor for list members

  • has_location (Boolean)

    Only return profiles with a location.

  • has_website (Boolean)

    Only return profiles with a website.

  • location_contains (String)

    Match a location substring, ignoring case.

  • max_followers (Integer)

    Maximum follower count. Missing counts pass this maximum.

  • max_following (Integer)

    Maximum following count.

  • max_statuses (Integer)

    Maximum post count. maxPosts is also accepted.

  • min_account_age_days (Integer)

    Minimum account age in whole days.

  • min_followers (Integer)

    Minimum follower count. Filtering happens before billing.

  • min_following (Integer)

    Minimum following count.

  • min_statuses (Integer)

    Minimum post count. minPosts is also accepted.

  • page_size (Integer)

    Members per page (20-200, default 20)

  • username_contains (String)

    Match a username substring, ignoring case.

  • verified_only (Boolean)

    Only return verified profiles.

  • verified_type (String)

    Match the verification type exactly, ignoring case.

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

Returns:

See Also:



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/x_twitter_scraper/resources/x/lists.rb', line 132

def retrieve_members(id, params = {})
  parsed, options = XTwitterScraper::X::ListRetrieveMembersParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/lists/%1$s/members", id],
    query: query.transform_keys(
      bio_contains: "bioContains",
      has_location: "hasLocation",
      has_website: "hasWebsite",
      location_contains: "locationContains",
      max_followers: "maxFollowers",
      max_following: "maxFollowing",
      max_statuses: "maxStatuses",
      min_account_age_days: "minAccountAgeDays",
      min_followers: "minFollowers",
      min_following: "minFollowing",
      min_statuses: "minStatuses",
      page_size: "pageSize",
      username_contains: "usernameContains",
      verified_only: "verifiedOnly",
      verified_type: "verifiedType"
    ),
    model: XTwitterScraper::PaginatedUsers,
    options: options
  )
end

#retrieve_tweets(id, cursor: nil, include_replies: nil, page_size: nil, since_time: nil, until_time: nil, request_options: {}) ⇒ XTwitterScraper::Models::PaginatedTweets

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

List tweets from an X List

Parameters:

  • id (String)

    List ID for tweet lookup

  • cursor (String)

    Pagination cursor for list tweets

  • include_replies (Boolean)

    Include replies (default false)

  • page_size (Integer)

    Maximum page items (1-100, default 20). Source, filters, or credits can reduce r

  • since_time (String)

    Unix timestamp - filter after

  • until_time (String)

    Unix timestamp - filter before

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

Returns:

See Also:



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/x_twitter_scraper/resources/x/lists.rb', line 184

def retrieve_tweets(id, params = {})
  parsed, options = XTwitterScraper::X::ListRetrieveTweetsParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["x/lists/%1$s/tweets", id],
    query: query.transform_keys(
      include_replies: "includeReplies",
      page_size: "pageSize",
      since_time: "sinceTime",
      until_time: "untilTime"
    ),
    model: XTwitterScraper::PaginatedTweets,
    options: options
  )
end