x-twitter-scraper 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/x_twitter_scraper/models/error.rb +12 -0
  5. data/lib/x_twitter_scraper/models/x/tweet_get_quotes_params.rb +2 -2
  6. data/lib/x_twitter_scraper/models/x/tweet_get_replies_params.rb +2 -2
  7. data/lib/x_twitter_scraper/models/x/tweet_get_thread_params.rb +309 -1
  8. data/lib/x_twitter_scraper/models/x/tweet_search_params.rb +2 -2
  9. data/lib/x_twitter_scraper/models/x/user_retrieve_likes_params.rb +2 -2
  10. data/lib/x_twitter_scraper/models/x/user_retrieve_media_params.rb +2 -2
  11. data/lib/x_twitter_scraper/models/x/user_retrieve_mentions_params.rb +2 -2
  12. data/lib/x_twitter_scraper/models/x/user_retrieve_replies_params.rb +2 -2
  13. data/lib/x_twitter_scraper/models/x/user_retrieve_tweets_params.rb +2 -2
  14. data/lib/x_twitter_scraper/resources/guest_wallets.rb +1 -1
  15. data/lib/x_twitter_scraper/resources/x/tweets.rb +98 -6
  16. data/lib/x_twitter_scraper/resources/x/users.rb +5 -5
  17. data/lib/x_twitter_scraper/version.rb +1 -1
  18. data/rbi/x_twitter_scraper/models/error.rbi +60 -0
  19. data/rbi/x_twitter_scraper/models/x/tweet_get_quotes_params.rbi +2 -2
  20. data/rbi/x_twitter_scraper/models/x/tweet_get_replies_params.rbi +2 -2
  21. data/rbi/x_twitter_scraper/models/x/tweet_get_thread_params.rbi +566 -0
  22. data/rbi/x_twitter_scraper/models/x/tweet_search_params.rbi +2 -2
  23. data/rbi/x_twitter_scraper/models/x/user_retrieve_likes_params.rbi +2 -2
  24. data/rbi/x_twitter_scraper/models/x/user_retrieve_media_params.rbi +2 -2
  25. data/rbi/x_twitter_scraper/models/x/user_retrieve_mentions_params.rbi +2 -2
  26. data/rbi/x_twitter_scraper/models/x/user_retrieve_replies_params.rbi +2 -2
  27. data/rbi/x_twitter_scraper/models/x/user_retrieve_tweets_params.rbi +2 -2
  28. data/rbi/x_twitter_scraper/resources/guest_wallets.rbi +1 -1
  29. data/rbi/x_twitter_scraper/resources/x/tweets.rbi +106 -4
  30. data/rbi/x_twitter_scraper/resources/x/users.rbi +5 -5
  31. data/sig/x_twitter_scraper/models/error.rbs +24 -0
  32. data/sig/x_twitter_scraper/models/x/tweet_get_thread_params.rbs +288 -1
  33. data/sig/x_twitter_scraper/resources/x/tweets.rbs +32 -0
  34. metadata +1 -1
@@ -260,7 +260,7 @@ module XTwitterScraper
260
260
  #
261
261
  # @param min_bookmarks [Integer] Minimum bookmark count threshold.
262
262
  #
263
- # @param min_faves [Integer] Minimum likes threshold.
263
+ # @param min_faves [Integer] Minimum likes threshold. minLikes is also accepted.
264
264
  #
265
265
  # @param min_quotes [Integer] Minimum quote count threshold.
266
266
  #
@@ -429,7 +429,7 @@ module XTwitterScraper
429
429
  #
430
430
  # @param min_bookmarks [Integer] Minimum bookmark count threshold.
431
431
  #
432
- # @param min_faves [Integer] Minimum likes threshold.
432
+ # @param min_faves [Integer] Minimum likes threshold. minLikes is also accepted.
433
433
  #
434
434
  # @param min_quotes [Integer] Minimum quote count threshold.
435
435
  #
@@ -621,14 +621,78 @@ module XTwitterScraper
621
621
  #
622
622
  # Get full conversation thread for a tweet
623
623
  #
624
- # @overload get_thread(id, cursor: nil, page_size: nil, request_options: {})
624
+ # @overload get_thread(id, any_words: nil, blue_verified_only: nil, cashtags: nil, conversation_id: nil, cursor: nil, exact_phrase: nil, exclude_words: nil, from_user: nil, hashtags: nil, in_reply_to_tweet_id: nil, language: nil, max_faves: nil, max_quotes: nil, max_replies: nil, max_retweets: nil, media_type: nil, mentioning: nil, min_bookmarks: nil, min_faves: nil, min_quotes: nil, min_replies: nil, min_retweets: nil, min_views: nil, page_size: nil, quotes: nil, quotes_of_tweet_id: nil, replies: nil, retweets: nil, retweets_of_tweet_id: nil, since_date: nil, to_user: nil, until_date: nil, url: nil, verified_only: nil, request_options: {})
625
625
  #
626
626
  # @param id [String] Tweet ID to get thread context
627
627
  #
628
+ # @param any_words [String] Words or quoted phrases where any one can match. Separate with spaces, commas, o
629
+ #
630
+ # @param blue_verified_only [Boolean] Only return tweets from Blue-verified authors.
631
+ #
632
+ # @param cashtags [String] Cashtags separated by spaces, commas, or lines.
633
+ #
634
+ # @param conversation_id [String] Conversation ID filter.
635
+ #
628
636
  # @param cursor [String] Pagination cursor for thread tweets
629
637
  #
638
+ # @param exact_phrase [String] Exact phrase to match.
639
+ #
640
+ # @param exclude_words [String] Words or quoted phrases to exclude. Separate with spaces, commas, or lines.
641
+ #
642
+ # @param from_user [String] Filter by author username.
643
+ #
644
+ # @param hashtags [String] Hashtags separated by spaces, commas, or lines.
645
+ #
646
+ # @param in_reply_to_tweet_id [String] Only replies to this tweet ID.
647
+ #
648
+ # @param language [String] Language code filter, e.g. en or tr.
649
+ #
650
+ # @param max_faves [Integer] Maximum likes threshold. maxLikes is also accepted.
651
+ #
652
+ # @param max_quotes [Integer] Maximum quotes threshold.
653
+ #
654
+ # @param max_replies [Integer] Maximum replies threshold.
655
+ #
656
+ # @param max_retweets [Integer] Maximum retweets threshold.
657
+ #
658
+ # @param media_type [Symbol, XTwitterScraper::Models::X::TweetGetThreadParams::MediaType] Filter by media type.
659
+ #
660
+ # @param mentioning [String] Filter tweets mentioning a username.
661
+ #
662
+ # @param min_bookmarks [Integer] Minimum bookmark count threshold.
663
+ #
664
+ # @param min_faves [Integer] Minimum likes threshold. minLikes is also accepted.
665
+ #
666
+ # @param min_quotes [Integer] Minimum quote count threshold.
667
+ #
668
+ # @param min_replies [Integer] Minimum replies threshold.
669
+ #
670
+ # @param min_retweets [Integer] Minimum retweets threshold.
671
+ #
672
+ # @param min_views [Integer] Minimum view count threshold.
673
+ #
630
674
  # @param page_size [Integer] Maximum page items (1-100, default 20). Source, filters, or credits can reduce r
631
675
  #
676
+ # @param quotes [Symbol, XTwitterScraper::Models::X::TweetGetThreadParams::Quotes] Quote mode.
677
+ #
678
+ # @param quotes_of_tweet_id [String] Only quotes of this tweet ID.
679
+ #
680
+ # @param replies [Symbol, XTwitterScraper::Models::X::TweetGetThreadParams::Replies] Reply mode.
681
+ #
682
+ # @param retweets [Symbol, XTwitterScraper::Models::X::TweetGetThreadParams::Retweets] Retweet mode.
683
+ #
684
+ # @param retweets_of_tweet_id [String] Only retweets of this tweet ID.
685
+ #
686
+ # @param since_date [Date] Start date in YYYY-MM-DD format.
687
+ #
688
+ # @param to_user [String] Filter replies sent to a username.
689
+ #
690
+ # @param until_date [Date] End date in YYYY-MM-DD format.
691
+ #
692
+ # @param url [String] URL substring or domain filter.
693
+ #
694
+ # @param verified_only [Boolean] Only return tweets from verified authors.
695
+ #
632
696
  # @param request_options [XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil]
633
697
  #
634
698
  # @return [XTwitterScraper::Models::PaginatedTweets]
@@ -640,7 +704,33 @@ module XTwitterScraper
640
704
  @client.request(
641
705
  method: :get,
642
706
  path: ["x/tweets/%1$s/thread", id],
643
- query: query.transform_keys(page_size: "pageSize"),
707
+ query: query.transform_keys(
708
+ any_words: "anyWords",
709
+ blue_verified_only: "blueVerifiedOnly",
710
+ conversation_id: "conversationId",
711
+ exact_phrase: "exactPhrase",
712
+ exclude_words: "excludeWords",
713
+ from_user: "fromUser",
714
+ in_reply_to_tweet_id: "inReplyToTweetId",
715
+ max_faves: "maxFaves",
716
+ max_quotes: "maxQuotes",
717
+ max_replies: "maxReplies",
718
+ max_retweets: "maxRetweets",
719
+ media_type: "mediaType",
720
+ min_bookmarks: "minBookmarks",
721
+ min_faves: "minFaves",
722
+ min_quotes: "minQuotes",
723
+ min_replies: "minReplies",
724
+ min_retweets: "minRetweets",
725
+ min_views: "minViews",
726
+ page_size: "pageSize",
727
+ quotes_of_tweet_id: "quotesOfTweetId",
728
+ retweets_of_tweet_id: "retweetsOfTweetId",
729
+ since_date: "sinceDate",
730
+ to_user: "toUser",
731
+ until_date: "untilDate",
732
+ verified_only: "verifiedOnly"
733
+ ),
644
734
  model: XTwitterScraper::PaginatedTweets,
645
735
  options: options
646
736
  )
@@ -649,7 +739,9 @@ module XTwitterScraper
649
739
  # Some parameter documentations has been truncated, see
650
740
  # {XTwitterScraper::Models::X::TweetSearchParams} for more details.
651
741
  #
652
- # No-mode search maximizes coverage.
742
+ # No-mode search maximizes coverage. New cursorless `Latest` sessions return rows
743
+ # newest-first across cursor pages. Existing cursors preserve their established
744
+ # ordering.
653
745
  #
654
746
  # @overload search(q:, advanced_query: nil, any_words: nil, blue_verified_only: nil, bounding_box: nil, card_name: nil, cashtags: nil, conversation_id: nil, cursor: nil, exact_phrase: nil, exclude_source: nil, exclude_words: nil, from_user: nil, geocode: nil, hashtags: nil, in_reply_to_tweet_id: nil, language: nil, limit: nil, list_id: nil, max_faves: nil, max_id: nil, max_quotes: nil, max_replies: nil, max_retweets: nil, media_type: nil, mentioning: nil, min_bookmarks: nil, min_faves: nil, min_quotes: nil, min_replies: nil, min_retweets: nil, min_views: nil, mode: nil, native_retweets: nil, near: nil, news: nil, place: nil, place_country: nil, point_radius: nil, query_type: nil, quotes: nil, quotes_of_tweet_id: nil, replies: nil, retweets: nil, retweets_of_tweet_id: nil, safe: nil, since_date: nil, since_id: nil, since_time: nil, source: nil, to_user: nil, until_date: nil, until_time: nil, url: nil, verified_only: nil, within: nil, within_time: nil, request_options: {})
655
747
  #
@@ -707,7 +799,7 @@ module XTwitterScraper
707
799
  #
708
800
  # @param min_bookmarks [Integer] Minimum bookmark count threshold.
709
801
  #
710
- # @param min_faves [Integer] Minimum likes threshold.
802
+ # @param min_faves [Integer] Minimum likes threshold. minLikes is also accepted.
711
803
  #
712
804
  # @param min_quotes [Integer] Minimum quote count threshold.
713
805
  #
@@ -377,7 +377,7 @@ module XTwitterScraper
377
377
  #
378
378
  # @param min_bookmarks [Integer] Minimum bookmark count threshold.
379
379
  #
380
- # @param min_faves [Integer] Minimum likes threshold.
380
+ # @param min_faves [Integer] Minimum likes threshold. minLikes is also accepted.
381
381
  #
382
382
  # @param min_quotes [Integer] Minimum quote count threshold.
383
383
  #
@@ -527,7 +527,7 @@ module XTwitterScraper
527
527
  #
528
528
  # @param min_bookmarks [Integer] Minimum bookmark count threshold.
529
529
  #
530
- # @param min_faves [Integer] Minimum likes threshold.
530
+ # @param min_faves [Integer] Minimum likes threshold. minLikes is also accepted.
531
531
  #
532
532
  # @param min_quotes [Integer] Minimum quote count threshold.
533
533
  #
@@ -677,7 +677,7 @@ module XTwitterScraper
677
677
  #
678
678
  # @param min_bookmarks [Integer] Minimum bookmark count threshold.
679
679
  #
680
- # @param min_faves [Integer] Minimum likes threshold.
680
+ # @param min_faves [Integer] Minimum likes threshold. minLikes is also accepted.
681
681
  #
682
682
  # @param min_quotes [Integer] Minimum quote count threshold.
683
683
  #
@@ -837,7 +837,7 @@ module XTwitterScraper
837
837
  #
838
838
  # @param min_bookmarks [Integer] Minimum bookmark count threshold.
839
839
  #
840
- # @param min_faves [Integer] Minimum likes threshold.
840
+ # @param min_faves [Integer] Minimum likes threshold. minLikes is also accepted.
841
841
  #
842
842
  # @param min_quotes [Integer] Minimum quote count threshold.
843
843
  #
@@ -1064,7 +1064,7 @@ module XTwitterScraper
1064
1064
  #
1065
1065
  # @param min_bookmarks [Integer] Minimum bookmark count threshold.
1066
1066
  #
1067
- # @param min_faves [Integer] Minimum likes threshold.
1067
+ # @param min_faves [Integer] Minimum likes threshold. minLikes is also accepted.
1068
1068
  #
1069
1069
  # @param min_quotes [Integer] Minimum quote count threshold.
1070
1070
  #
@@ -5,5 +5,5 @@
5
5
  # frozen_string_literal: true
6
6
 
7
7
  module XTwitterScraper
8
- VERSION = "0.9.0"
8
+ VERSION = "0.10.0"
9
9
  end
@@ -397,11 +397,21 @@ module XTwitterScraper
397
397
  :invalid_community_id,
398
398
  XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
399
399
  )
400
+ INVALID_COMPLETE_REPLIES_REQUEST =
401
+ T.let(
402
+ :invalid_complete_replies_request,
403
+ XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
404
+ )
400
405
  INVALID_COVERAGE_CURSOR =
401
406
  T.let(
402
407
  :invalid_coverage_cursor,
403
408
  XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
404
409
  )
410
+ INVALID_COVERAGE_REQUEST =
411
+ T.let(
412
+ :invalid_coverage_request,
413
+ XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
414
+ )
405
415
  INVALID_IDEMPOTENCY_KEY =
406
416
  T.let(
407
417
  :invalid_idempotency_key,
@@ -412,6 +422,11 @@ module XTwitterScraper
412
422
  :invalid_list_id,
413
423
  XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
414
424
  )
425
+ INVALID_OUTPUT_OPTIONS =
426
+ T.let(
427
+ :invalid_output_options,
428
+ XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
429
+ )
415
430
  INVALID_PAYMENT_AMOUNT =
416
431
  T.let(
417
432
  :invalid_payment_amount,
@@ -422,11 +437,21 @@ module XTwitterScraper
422
437
  :invalid_range,
423
438
  XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
424
439
  )
440
+ INVALID_REPLY_OPTIONS =
441
+ T.let(
442
+ :invalid_reply_options,
443
+ XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
444
+ )
425
445
  LOGIN_RATE_LIMITED =
426
446
  T.let(
427
447
  :login_rate_limited,
428
448
  XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
429
449
  )
450
+ LOGIN_SERVICE_UNAVAILABLE =
451
+ T.let(
452
+ :login_service_unavailable,
453
+ XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
454
+ )
430
455
  MISSING_IDEMPOTENCY_KEY =
431
456
  T.let(
432
457
  :missing_idempotency_key,
@@ -477,6 +502,11 @@ module XTwitterScraper
477
502
  :too_many_ids,
478
503
  XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
479
504
  )
505
+ TOO_MANY_TWEETS =
506
+ T.let(
507
+ :too_many_tweets,
508
+ XTwitterScraper::Error::Error::LegacyErrorCode::TaggedSymbol
509
+ )
480
510
  UNKNOWN_FIELD =
481
511
  T.let(
482
512
  :unknown_field,
@@ -988,11 +1018,21 @@ module XTwitterScraper
988
1018
  :invalid_community_id,
989
1019
  XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
990
1020
  )
1021
+ INVALID_COMPLETE_REPLIES_REQUEST =
1022
+ T.let(
1023
+ :invalid_complete_replies_request,
1024
+ XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
1025
+ )
991
1026
  INVALID_COVERAGE_CURSOR =
992
1027
  T.let(
993
1028
  :invalid_coverage_cursor,
994
1029
  XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
995
1030
  )
1031
+ INVALID_COVERAGE_REQUEST =
1032
+ T.let(
1033
+ :invalid_coverage_request,
1034
+ XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
1035
+ )
996
1036
  INVALID_IDEMPOTENCY_KEY =
997
1037
  T.let(
998
1038
  :invalid_idempotency_key,
@@ -1003,6 +1043,11 @@ module XTwitterScraper
1003
1043
  :invalid_list_id,
1004
1044
  XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
1005
1045
  )
1046
+ INVALID_OUTPUT_OPTIONS =
1047
+ T.let(
1048
+ :invalid_output_options,
1049
+ XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
1050
+ )
1006
1051
  INVALID_PAYMENT_AMOUNT =
1007
1052
  T.let(
1008
1053
  :invalid_payment_amount,
@@ -1013,11 +1058,21 @@ module XTwitterScraper
1013
1058
  :invalid_range,
1014
1059
  XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
1015
1060
  )
1061
+ INVALID_REPLY_OPTIONS =
1062
+ T.let(
1063
+ :invalid_reply_options,
1064
+ XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
1065
+ )
1016
1066
  LOGIN_RATE_LIMITED =
1017
1067
  T.let(
1018
1068
  :login_rate_limited,
1019
1069
  XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
1020
1070
  )
1071
+ LOGIN_SERVICE_UNAVAILABLE =
1072
+ T.let(
1073
+ :login_service_unavailable,
1074
+ XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
1075
+ )
1021
1076
  MISSING_IDEMPOTENCY_KEY =
1022
1077
  T.let(
1023
1078
  :missing_idempotency_key,
@@ -1068,6 +1123,11 @@ module XTwitterScraper
1068
1123
  :too_many_ids,
1069
1124
  XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
1070
1125
  )
1126
+ TOO_MANY_TWEETS =
1127
+ T.let(
1128
+ :too_many_tweets,
1129
+ XTwitterScraper::Error::Error::StructuredError::Code::TaggedSymbol
1130
+ )
1071
1131
  UNKNOWN_FIELD =
1072
1132
  T.let(
1073
1133
  :unknown_field,
@@ -195,7 +195,7 @@ module XTwitterScraper
195
195
  sig { params(min_bookmarks: Integer).void }
196
196
  attr_writer :min_bookmarks
197
197
 
198
- # Minimum likes threshold.
198
+ # Minimum likes threshold. minLikes is also accepted.
199
199
  sig { returns(T.nilable(Integer)) }
200
200
  attr_reader :min_faves
201
201
 
@@ -517,7 +517,7 @@ module XTwitterScraper
517
517
  mentioning: nil,
518
518
  # Minimum bookmark count threshold.
519
519
  min_bookmarks: nil,
520
- # Minimum likes threshold.
520
+ # Minimum likes threshold. minLikes is also accepted.
521
521
  min_faves: nil,
522
522
  # Minimum quote count threshold.
523
523
  min_quotes: nil,
@@ -226,7 +226,7 @@ module XTwitterScraper
226
226
  sig { params(min_bookmarks: Integer).void }
227
227
  attr_writer :min_bookmarks
228
228
 
229
- # Minimum likes threshold.
229
+ # Minimum likes threshold. minLikes is also accepted.
230
230
  sig { returns(T.nilable(Integer)) }
231
231
  attr_reader :min_faves
232
232
 
@@ -616,7 +616,7 @@ module XTwitterScraper
616
616
  mentioning: nil,
617
617
  # Minimum bookmark count threshold.
618
618
  min_bookmarks: nil,
619
- # Minimum likes threshold.
619
+ # Minimum likes threshold. minLikes is also accepted.
620
620
  min_faves: nil,
621
621
  # Minimum quote count threshold.
622
622
  min_quotes: nil,