Get all tweets and replies posted by a specific Twitter user. Returns a comprehensive list including both original tweets and reply tweets posted by the user. $0.10/1000 items.
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.timelines.tweets_and_replies(screen_name="elonmusk", count=50)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
screen_name |
str |
✔️ |
The screen name (username) of the Twitter user to get all tweets and replies from. |
elonmusk |
count |
int |
✔️ |
Maximum number of tweets and replies to return. |
50 |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
models.SearchResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
Fetch a single page from a user's timeline using POST. Pass next_cursor in the body to continue.
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.timelines.user_page(screen_name="axiaisacat", next_cursor="DAAHCgABHFeD5h9__-cLAAIAAAATMjAzODIzMzA5NTM4ODY4MDU5NAgAAwAAAAIAAA", count=20)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
screen_name |
str |
✔️ |
Twitter screen name of the target user (with or without @). |
axiaisacat |
next_cursor |
OptionalNullable[str] |
➖ |
Cursor returned by the previous page. Leave empty to fetch the first page. |
DAAHCgABHFeD5h9__-cLAAIAAAATMjAzODIzMzA5NTM4ODY4MDU5NAgAAwAAAAIAAA |
count |
Optional[int] |
➖ |
Maximum number of tweets to return for this page. |
20 |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
models.UserTimelinePageResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
Fetch a user's timeline across pages using POST and try to fill the requested count.
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.timelines.user(screen_name="axiaisacat", count=20)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
screen_name |
str |
✔️ |
Twitter screen name of the target user (with or without @). |
axiaisacat |
count |
Optional[int] |
➖ |
Maximum number of tweets to return across all pages. |
20 |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
models.UserTimelineResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
Retrieve a paginated list of a user's tweets and replies using cursor-based pagination. Each page returns up to 20 items. Pass next_cursor from the previous response to continue. Pricing: $0.10 per 1,000 items.
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.timelines.tweets_and_replies_page(screen_name="elonmusk", next_cursor="1234567890")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
screen_name |
str |
✔️ |
Twitter screen name of the target user (with or without @). |
elonmusk |
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. |
|
models.GetAllTweetsRepliesCursorResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |