Skip to content

Latest commit

 

History

History
264 lines (171 loc) · 15.7 KB

File metadata and controls

264 lines (171 loc) · 15.7 KB

Lists

Overview

Available Operations

tweets

Get list tweets

Example Usage

import os
from x_api_scraper import XapiScraper


with XapiScraper(
    bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:

    res = xapi_scraper.lists.tweets(list_id="<id>", target_count=277741)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
list_id str ✔️ N/A
target_count int ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ListTweetsResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.XapiScraperDefaultError 4XX, 5XX */*

tweets_page

Retrieve a paginated list of list tweets using cursor-based pagination. Each page returns up to 20 tweets. Pass next_cursor from the previous response to continue. Pricing: $0.10 per 1,000 tweets.

Example Usage

import os
from x_api_scraper import XapiScraper


with XapiScraper(
    bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:

    res = xapi_scraper.lists.tweets_page(list_id="<id>", next_cursor="1234567890")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
list_id str ✔️ The ID of the list to get tweets from.
next_cursor OptionalNullable[str] Cursor returned by the previous page. Leave empty to fetch the first page. 1234567890
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetListTweetsCursorResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.XapiScraperDefaultError 4XX, 5XX */*

subscribers

Get list subscribers

Example Usage

import os
from x_api_scraper import XapiScraper


with XapiScraper(
    bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:

    res = xapi_scraper.lists.subscribers(list_id="<id>", target_count=440492)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
list_id str ✔️ N/A
target_count int ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ListSubscribersResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.XapiScraperDefaultError 4XX, 5XX */*

members

Get list members

Example Usage

import os
from x_api_scraper import XapiScraper


with XapiScraper(
    bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:

    res = xapi_scraper.lists.members(list_id="<id>", target_count=685648)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
list_id str ✔️ N/A
target_count int ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ListMembersResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.XapiScraperDefaultError 4XX, 5XX */*

members_page

Retrieve a paginated list of list members using cursor-based pagination. Each page returns up to 20 members. Pass next_cursor from the previous response to continue. Pricing: $0.10 per 1,000 members.

Example Usage

import os
from x_api_scraper import XapiScraper


with XapiScraper(
    bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:

    res = xapi_scraper.lists.members_page(list_id="<id>", next_cursor="1234567890")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
list_id str ✔️ The ID of the list to get members from.
next_cursor OptionalNullable[str] Cursor returned by the previous page. Leave empty to fetch the first page. 1234567890
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetListMembersCursorResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.XapiScraperDefaultError 4XX, 5XX */*

search

Search list

Example Usage

import os
from x_api_scraper import XapiScraper


with XapiScraper(
    bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:

    res = xapi_scraper.lists.search(query="<value>", target_count=810476)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
query str ✔️ The query to search for.
target_count int ✔️ The number of lists to search.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SearchListResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.XapiScraperDefaultError 4XX, 5XX */*