- Detail - Get Tweet Detail
- Thread - Get Tweet Thread by ID
- Lookup - Batch Get Tweets by ID
- Similar - Get Similar 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 main
import(
"context"
"os"
xapiscraper "github.com/twexapi-dev/x-api-scraper-go"
"log"
)
func main() {
ctx := context.Background()
s := xapiscraper.New(
xapiscraper.WithSecurity(os.Getenv("X_API_SCRAPER_BEARER_AUTH")),
)
res, err := s.Tweets.Detail(ctx, []string{
"2076874251915743687",
})
if err != nil {
log.Fatal(err)
}
if res.Any != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
[]string | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.TweetsDetailResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.HTTPValidationError | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |
Retrieve all tweets in a thread by tweet ID, sorted by latest.
package main
import(
"context"
"os"
xapiscraper "github.com/twexapi-dev/x-api-scraper-go"
"github.com/twexapi-dev/x-api-scraper-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := xapiscraper.New(
xapiscraper.WithSecurity(os.Getenv("X_API_SCRAPER_BEARER_AUTH")),
)
res, err := s.Tweets.Thread(ctx, components.TweetThreadByIDBody{
TweetID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.Any != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.TweetThreadByIDBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.TweetsThreadResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.HTTPValidationError | 422 | application/json |
| apierrors.APIError | 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 main
import(
"context"
"os"
xapiscraper "github.com/twexapi-dev/x-api-scraper-go"
"log"
)
func main() {
ctx := context.Background()
s := xapiscraper.New(
xapiscraper.WithSecurity(os.Getenv("X_API_SCRAPER_BEARER_AUTH")),
)
res, err := s.Tweets.Lookup(ctx, []string{
"1803006263529541838",
})
if err != nil {
log.Fatal(err)
}
if res.GetTweetsByIDResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
[]string | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.TweetsLookupResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.HTTPValidationError | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |
Get similar tweets
package main
import(
"context"
"os"
xapiscraper "github.com/twexapi-dev/x-api-scraper-go"
"github.com/twexapi-dev/x-api-scraper-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := xapiscraper.New(
xapiscraper.WithSecurity(os.Getenv("X_API_SCRAPER_BEARER_AUTH")),
)
res, err := s.Tweets.Similar(ctx, operations.TweetsSimilarRequest{
TweetID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.GetTweetsByIDResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.TweetsSimilarRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.TweetsSimilarResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.HTTPValidationError | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |