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.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TimelinesTweetsAndRepliesRequest;
import io.twexapi.sdk.models.operations.TimelinesTweetsAndRepliesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
TimelinesTweetsAndRepliesRequest req = TimelinesTweetsAndRepliesRequest.builder()
.screenName("elonmusk")
.count(50L)
.build();
TimelinesTweetsAndRepliesResponse res = sdk.timelines().tweetsAndReplies()
.request(req)
.call();
if (res.searchResponse().isPresent()) {
System.out.println(res.searchResponse().get());
}
}
}
TimelinesTweetsAndRepliesResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Fetch a single page from a user's timeline using POST. Pass next_cursor in the body to continue.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.UserTimelinePageQuery;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TimelinesUserPageRequest;
import io.twexapi.sdk.models.operations.TimelinesUserPageResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
TimelinesUserPageRequest req = TimelinesUserPageRequest.builder()
.screenName("axiaisacat")
.body(UserTimelinePageQuery.builder()
.nextCursor("DAAHCgABHFeD5h9__-cLAAIAAAATMjAzODIzMzA5NTM4ODY4MDU5NAgAAwAAAAIAAA")
.build())
.build();
TimelinesUserPageResponse res = sdk.timelines().userPage()
.request(req)
.call();
if (res.userTimelinePageResponse().isPresent()) {
System.out.println(res.userTimelinePageResponse().get());
}
}
}
TimelinesUserPageResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Fetch a user's timeline across pages using POST and try to fill the requested count.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.UserTimelineFillQuery;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TimelinesUserRequest;
import io.twexapi.sdk.models.operations.TimelinesUserResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
TimelinesUserRequest req = TimelinesUserRequest.builder()
.screenName("axiaisacat")
.body(UserTimelineFillQuery.builder()
.build())
.build();
TimelinesUserResponse res = sdk.timelines().user()
.request(req)
.call();
if (res.userTimelineResponse().isPresent()) {
System.out.println(res.userTimelineResponse().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
TimelinesUserRequest |
✔️ |
The request object to use for the request. |
TimelinesUserResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
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.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.GetAllTweetsRepliesCursorQuery;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TimelinesTweetsAndRepliesPageResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
GetAllTweetsRepliesCursorQuery req = GetAllTweetsRepliesCursorQuery.builder()
.screenName("elonmusk")
.nextCursor("1234567890")
.build();
TimelinesTweetsAndRepliesPageResponse res = sdk.timelines().tweetsAndRepliesPage()
.request(req)
.call();
if (res.getAllTweetsRepliesCursorResponse().isPresent()) {
System.out.println(res.getAllTweetsRepliesCursorResponse().get());
}
}
}
TimelinesTweetsAndRepliesPageResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |