Tweets
Retrieve detailed information for one or more tweets by ID (no cookie required). The maximum input quantity is limited by your plan's QPS. To pass larger input quantity limits, upgrade your plan to get higher QPS.
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.detail(request=[
"2076874251915743687",
])
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
request |
List[str] |
✔️ |
The request object to use for the request. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
Any
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
Retrieve all tweets in a thread by tweet ID, sorted by latest.
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.thread(tweet_id="<id>", max_items=40)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
tweet_id |
str |
✔️ |
The root tweet ID to fetch the thread for |
max_items |
Optional[int] |
➖ |
Max number of thread tweets to return |
fields |
List[str] |
➖ |
Fields to include in each tweet. If omitted, all fields are returned. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
Any
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
Retrieve detailed information for multiple Tweets by their IDs. The maximum input quantity is limited by your plan's QPS. To pass larger input quantity limits, upgrade your plan to get higher QPS.
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.lookup(request=[
"1803006263529541838",
])
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
request |
List[str] |
✔️ |
The request object to use for the request. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetTweetsByIDResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
Get similar tweets
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.similar(tweet_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
tweet_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetTweetsByIDResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |