Skip to content

Latest commit

 

History

History
50 lines (32 loc) · 4.02 KB

File metadata and controls

50 lines (32 loc) · 4.02 KB

Tweets.Replies

Overview

Available Operations

  • page - Get Replies by Page

page

Recommended for fetching tweet replies. Uses cursor-based pagination and avoids timeouts on large threads. The first request (omit next_cursor) returns root_tweet plus the first batch of replies. Pass next_cursor from the previous response to fetch the next page until has_next_page is false. Pricing: $0.10 per 1,000 replies.

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.tweets.replies.page(tweet_id="1803006263529541838", sort_by="Recency")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
tweet_id str ✔️ The ID of the tweet to get replies for. 1803006263529541838
next_cursor OptionalNullable[str] Cursor returned by the previous page. Leave empty to fetch the first page.
sort_by Optional[models.GetRepliesPageQuerySortBy] Sort replies by Relevance, Recency, or Likes. Recency
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetRepliesPageResponse

Errors

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