Perform advanced Twitter search with 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. 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"
"github.com/twexapi-dev/x-api-scraper-go/optionalnullable"
"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.Search.Advanced(ctx, components.AdvancedSearchCursorQuery{
SearchTerms: []string{
"<value 1>",
"<value 2>",
"<value 3>",
},
SortBy: "<value>",
NextCursor: optionalnullable.From(xapiscraper.Pointer("")),
})
if err != nil {
log.Fatal(err)
}
if res.AdvancedSearchCursorResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.AdvancedSearchCursorQuery | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SearchAdvancedResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.HTTPValidationError | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |
Search for tweets containing specific cashtags (stock symbols), $0.10/1000 tweets. 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"
"github.com/twexapi-dev/x-api-scraper-go/optionalnullable"
"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.Search.Cashtags(ctx, components.CashtagsQuery{
Cashtags: []string{
"AAPL",
"TSLA",
},
StartTime: optionalnullable.From(xapiscraper.Pointer("1775726400")),
EndTime: optionalnullable.From(xapiscraper.Pointer("1775727300")),
Language: optionalnullable.From(xapiscraper.Pointer(components.CashtagsQueryLanguageEn)),
})
if err != nil {
log.Fatal(err)
}
if res.SearchResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.CashtagsQuery | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SearchCashtagsResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.HTTPValidationError | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |
Search for tweets containing specific hashtags. 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"
"github.com/twexapi-dev/x-api-scraper-go/optionalnullable"
"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.Search.Hashtags(ctx, components.HashtagsQuery{
Hashtags: []string{
"btc",
"eth",
},
StartTime: optionalnullable.From(xapiscraper.Pointer("1775726400")),
EndTime: optionalnullable.From(xapiscraper.Pointer("1775727300")),
Language: optionalnullable.From(xapiscraper.Pointer(components.HashtagsQueryLanguageEn)),
})
if err != nil {
log.Fatal(err)
}
if res.SearchResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.HashtagsQuery | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SearchHashtagsResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.HTTPValidationError | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |