- countries - List Global Trend Countries
- topics - List Global Trend Topics
- contents - List Global Trend Content Tags
- tweets - Get Global Trending Tweets
- by_country - Get Trending Topics
Get the supported country and global options that can be used to filter trending tweets.
require 'x_api_scraper'
Models = ::XapiScraper::Models
s = ::XapiScraper::Client.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.trending.countries
unless res.standard_response.nil?
# handle response
endT.nilable(Models::Operations::TrendingCountriesResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors::APIError | 4XX, 5XX | */* |
Get the topic categories available for filtering global trending tweets.
require 'x_api_scraper'
Models = ::XapiScraper::Models
s = ::XapiScraper::Client.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.trending.topics
unless res.standard_response.nil?
# handle response
endT.nilable(Models::Operations::TrendingTopicsResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors::APIError | 4XX, 5XX | */* |
Get content tags for a selected country and topic so tweets can be filtered more precisely.
require 'x_api_scraper'
Models = ::XapiScraper::Models
s = ::XapiScraper::Client.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
req = Models::Operations::TrendingContentsRequest.new(
country: 'Monaco',
topic: '<value>'
)
res = s.trending.contents(request: req)
unless res.standard_response.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
request |
Models::Operations::TrendingContentsRequest | ✔️ | The request object to use for the request. |
T.nilable(Models::Operations::TrendingContentsResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::HTTPValidationError | 422 | application/json |
| Errors::APIError | 4XX, 5XX | */* |
Get trending tweets for a country, with optional topic and content tag filters.
require 'x_api_scraper'
Models = ::XapiScraper::Models
s = ::XapiScraper::Client.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
req = Models::Operations::TrendingTweetsRequest.new(
country: 'Lithuania'
)
res = s.trending.tweets(request: req)
unless res.search_response.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
request |
Models::Operations::TrendingTweetsRequest | ✔️ | The request object to use for the request. |
T.nilable(Models::Operations::TrendingTweetsResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::HTTPValidationError | 422 | application/json |
| Errors::APIError | 4XX, 5XX | */* |
Get X Explore trending topics for a given country. Use 'worldwide' for account-default trends or a country slug such as 'united-states'.
require 'x_api_scraper'
Models = ::XapiScraper::Models
s = ::XapiScraper::Client.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
req = Models::Operations::TrendingByCountryRequest.new(
country: Models::Operations::Country::WORLDWIDE
)
res = s.trending.by_country(request: req)
unless res.standard_response.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
request |
Models::Operations::TrendingByCountryRequest | ✔️ | The request object to use for the request. |
T.nilable(Models::Operations::TrendingByCountryResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::HTTPValidationError | 422 | application/json |
| Errors::APIError | 4XX, 5XX | */* |