Get community members
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.communities.members(community_id="<id>", target_count=298640)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
community_id |
str |
✔️ |
N/A |
target_count |
int |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.SearchUserResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
Retrieve a paginated list of community 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.
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.communities.members_page(community_id="<id>", next_cursor="1234567890")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
community_id |
str |
✔️ |
The ID of the community 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. |
|
models.GetCommunityMembersCursorResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
tweets
Get community 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.communities.tweets(community_id="<id>", tweet_type="Media", target_count=682850)
# Handle response
print(res)
models.CommunityTweetsResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
tweets_page
Retrieve a paginated list of community 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.
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.communities.tweets_page(community_id="<id>", tweet_type="Top", next_cursor="1234567890")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
community_id |
str |
✔️ |
The ID of the community to get tweets from. |
|
tweet_type |
models.TweetType |
✔️ |
The type of tweets to get. |
|
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.GetCommunityTweetsCursorResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
Search community
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.communities.search(query="<value>", target_count=761546)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
query |
str |
✔️ |
The query to search for. |
target_count |
int |
✔️ |
The number of communities to search. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.SearchCommunityResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
Get community
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.communities.get(community_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
community_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetCommunityResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |
search_tweets
Search community 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.communities.search_tweets(community_id="<id>", target_count=687977, query="<value>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
community_id |
str |
✔️ |
The ID of the community. |
target_count |
int |
✔️ |
The number of tweets to search. |
query |
str |
✔️ |
The query to search for. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.CommunityTweetsResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.XapiScraperDefaultError |
4XX, 5XX |
*/* |