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.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TweetsDetailResponse;
import java.lang.Exception;
import java.lang.String;
import java.util.List;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
List<String> req = List.of(
"2076874251915743687");
TweetsDetailResponse res = sdk.tweets().detail()
.request(req)
.call();
if (res.any().isPresent()) {
System.out.println(res.any().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
List |
✔️ |
The request object to use for the request. |
TweetsDetailResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Retrieve all tweets in a thread by tweet ID, sorted by latest.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.TweetThreadByIdBody;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TweetsThreadResponse;
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();
TweetThreadByIdBody req = TweetThreadByIdBody.builder()
.tweetId("<id>")
.build();
TweetsThreadResponse res = sdk.tweets().thread()
.request(req)
.call();
if (res.any().isPresent()) {
System.out.println(res.any().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
TweetThreadByIdBody |
✔️ |
The request object to use for the request. |
TweetsThreadResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
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.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TweetsLookupResponse;
import java.lang.Exception;
import java.lang.String;
import java.util.List;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
List<String> req = List.of(
"1803006263529541838");
TweetsLookupResponse res = sdk.tweets().lookup()
.request(req)
.call();
if (res.getTweetsByIdResponse().isPresent()) {
System.out.println(res.getTweetsByIdResponse().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
List |
✔️ |
The request object to use for the request. |
TweetsLookupResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Get similar tweets
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TweetsSimilarRequest;
import io.twexapi.sdk.models.operations.TweetsSimilarResponse;
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();
TweetsSimilarRequest req = TweetsSimilarRequest.builder()
.tweetId("<id>")
.build();
TweetsSimilarResponse res = sdk.tweets().similar()
.request(req)
.call();
if (res.getTweetsByIdResponse().isPresent()) {
System.out.println(res.getTweetsByIdResponse().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
TweetsSimilarRequest |
✔️ |
The request object to use for the request. |
TweetsSimilarResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |