Class: XTwitterScraper::Models::RadarItem::Metadata

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/x_twitter_scraper/models/radar_item.rb,
sig/x_twitter_scraper/models/radar_item.rbs

Overview

See Also:

  • XTwitterScraper::Models::RadarItem#metadata

Defined Under Namespace

Modules: SourceFormat

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(author: nil, content_url: nil, estimated_downvotes: nil, estimated_upvotes: nil, number_comments: nil, score: nil, selftext: nil, source_format: nil, subreddit: nil, upvote_ratio: nil) ⇒ Object

Source-specific fields. Shape varies per source:

  • reddit: { author, authorId?, subreddit, subredditId?, subredditSubscribers?, sourceFormat, score?, upvoteRatio?, estimatedUpvotes?, estimatedDownvotes?, numberComments?, numberCrossposts?, selftext?, contentUrl?, domain?, postHint?, linkFlairText?, distinguished?, totalAwardsReceived?, viewCount?, editedAt?, galleryImageUrls?, redditVideo?, archived?, contestMode?, isCrosspostable?, isMeta?, isNsfw?, isOriginalContent?, isRobotIndexable?, isSelf?, isSpoiler?, isVideo?, locked?, stickied? }. score is Reddit's public net score. Exact public upvote and downvote counts are not available. Estimated counts derive from the public score and upvote ratio, which Reddit may fuzz. Comment bodies are not included. Current items combine public listing discovery with server-rendered post data and use sourceFormat: html; json and rss remain for legacy rows.
  • github: { starsToday: number }
  • hacker_news: { points: number, numberComments: number }
  • google_trends: { approxTraffic: number }
  • polymarket: { volume24hr: number }
  • wikipedia: { views: number }
  • trustmrr: { mrr, growthPercent, last30Days, total, customers, activeSubscriptions, onSale, xHandle?, category?, askingPrice?, country?, foundedDate?, googleSearchImpressionsLast30Days?, growthMrrPercent?, multiple?, paymentProvider?, profitMarginLast30Days?, rank?, revenuePerVisitor?, targetAudience?, visitorsLast30Days? } For the startup growth source, xHandle is the founder's X username without @. The rank field is the source's revenue rank. Result order represents reported 30-day revenue-growth rank.

Parameters:

  • author (String) (defaults to: nil)
  • content_url (String) (defaults to: nil)
  • estimated_downvotes (Integer) (defaults to: nil)
  • estimated_upvotes (Integer) (defaults to: nil)
  • number_comments (Integer) (defaults to: nil)
  • score (Integer) (defaults to: nil)
  • selftext (String) (defaults to: nil)
  • source_format (Symbol, XTwitterScraper::Models::RadarItem::Metadata::SourceFormat) (defaults to: nil)

    Current items use html. json and rss are retained for legacy rows.

  • subreddit (String) (defaults to: nil)
  • upvote_ratio (Float) (defaults to: nil)


# File 'lib/x_twitter_scraper/models/radar_item.rb', line 218

Instance Attribute Details

#authorString?

Parameters:

  • (String)

Returns:

  • (String, nil)


168
# File 'lib/x_twitter_scraper/models/radar_item.rb', line 168

optional :author, String

#content_urlString?

Parameters:

  • (String)

Returns:

  • (String, nil)


173
# File 'lib/x_twitter_scraper/models/radar_item.rb', line 173

optional :content_url, String, api_name: :contentUrl

#estimated_downvotesInteger?

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


178
# File 'lib/x_twitter_scraper/models/radar_item.rb', line 178

optional :estimated_downvotes, Integer, api_name: :estimatedDownvotes

#estimated_upvotesInteger?

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


183
# File 'lib/x_twitter_scraper/models/radar_item.rb', line 183

optional :estimated_upvotes, Integer, api_name: :estimatedUpvotes

#number_commentsInteger?

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


188
# File 'lib/x_twitter_scraper/models/radar_item.rb', line 188

optional :number_comments, Integer, api_name: :numberComments

#scoreInteger?

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


193
# File 'lib/x_twitter_scraper/models/radar_item.rb', line 193

optional :score, Integer

#selftextString?

Parameters:

  • (String)

Returns:

  • (String, nil)


198
# File 'lib/x_twitter_scraper/models/radar_item.rb', line 198

optional :selftext, String

#source_formatSymbol, ...

Current items use html. json and rss are retained for legacy rows.



204
205
206
# File 'lib/x_twitter_scraper/models/radar_item.rb', line 204

optional :source_format,
enum: -> { XTwitterScraper::RadarItem::Metadata::SourceFormat },
api_name: :sourceFormat

#subredditString?

Parameters:

  • (String)

Returns:

  • (String, nil)


211
# File 'lib/x_twitter_scraper/models/radar_item.rb', line 211

optional :subreddit, String

#upvote_ratioFloat?

Parameters:

  • (Float)

Returns:

  • (Float, nil)


216
# File 'lib/x_twitter_scraper/models/radar_item.rb', line 216

optional :upvote_ratio, Float, api_name: :upvoteRatio

Instance Method Details

#to_hash{

Returns:

  • ({)


189
# File 'sig/x_twitter_scraper/models/radar_item.rbs', line 189

def to_hash: -> {