Class: XTwitterScraper::Resources::Trends

Inherits:
Object
  • Object
show all
Defined in:
lib/x_twitter_scraper/resources/trends.rb

Overview

Trending topics by region

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Trends

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Trends.

Parameters:



35
36
37
# File 'lib/x_twitter_scraper/resources/trends.rb', line 35

def initialize(client:)
  @client = client
end

Instance Method Details

#list(count: nil, woeid: nil, request_options: {}) ⇒ XTwitterScraper::Models::TrendListResponse

Get regional trending topics

Parameters:

  • count (Integer)

    Number of trending topics to return (1-50, default 30)

  • woeid (Integer)

    Region WOEID (1=Worldwide, 23424977=US, 23424975=UK, 23424969=Turkey)

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/x_twitter_scraper/resources/trends.rb', line 20

def list(params = {})
  parsed, options = XTwitterScraper::TrendListParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "trends",
    query: query,
    model: XTwitterScraper::Models::TrendListResponse,
    options: options
  )
end