x-twitter-scraper 0.10.1 → 0.10.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07ed3b8240c037a3f99aca376db32637542303f31d4aa2e1ab3cbbd45e94e595
4
- data.tar.gz: 3a04bda0ac118544b66225dd59839060d7032a159cbc0a80ea91bacc506c51c2
3
+ metadata.gz: 377c00b19b9d19ebb8a350b172937dc5805869f1e7d500da6ec4fec43996d659
4
+ data.tar.gz: e57a1128b31495941ff65b3418c059d64c2afb3d7ae69de55b1ce45937a73c59
5
5
  SHA512:
6
- metadata.gz: 34ffbe878b79d348581e1b993c3e0745869e2dc3a629fd1519bdda9ab14874af696c74fac495d460813f27fe918b7aae50bd58bf8cc242989dbd05a09d1b55c1
7
- data.tar.gz: c5286cb6368825d7a98c4bd48e50ac08c4f506898a991a3f6080ae1b1cd8d6c82fa38d0243716bdbfb86546ff22e1366273176d184e16b0b75a3bd3a6279d272
6
+ metadata.gz: 81ef337f2a4176e1d855428f770bc6fd4f758f4512183c6284d8e07a2d44c2cd658c8b17e008c7f10bbf9dc56d3b4c224c518c91da46b2a7080fbab0a61ed6f7
7
+ data.tar.gz: 91c815184295402c9bb9a13317d7743942b8fcfa0c991324af1995064ed63748c9cb4cc052980fe479dda23591d21ee4c14fe21e9f351093a614b770ded2cf9d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.3 (2026-08-21)
4
+
5
+ Full Changelog: [v0.10.2...v0.10.3](https://github.com/Xquik-dev/x-twitter-scraper-ruby/compare/v0.10.2...v0.10.3)
6
+
7
+ ### Documentation
8
+
9
+ * tighten SDK and contribution guidance
10
+
11
+ ### Chores
12
+
13
+ * simplify repository comments and formatter output
14
+
15
+ ## 0.10.2 (2026-08-20)
16
+
17
+ Full Changelog: [v0.10.1...v0.10.2](https://github.com/Xquik-dev/x-twitter-scraper-ruby/compare/v0.10.1...v0.10.2)
18
+
19
+ ### Documentation
20
+
21
+ * refine public Ruby SDK text ([#49](https://github.com/Xquik-dev/x-twitter-scraper-ruby/issues/49)) ([3d79615](https://github.com/Xquik-dev/x-twitter-scraper-ruby/commit/3d79615cf4c1acc0ec8a6272d684302fe43e60dc))
22
+
3
23
  ## 0.10.1 (2026-08-18)
4
24
 
5
25
  Full Changelog: [v0.10.0...v0.10.1](https://github.com/Xquik-dev/x-twitter-scraper-ruby/compare/v0.10.0...v0.10.1)
data/README.md CHANGED
@@ -1,32 +1,26 @@
1
- # X (Twitter) Scraper Ruby SDK: Tweet Search, Timelines, Followers & Posting
1
+ # Xquik Ruby SDK: Twitter Search, Followers & X Automation
2
2
 
3
3
  [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/13739/badge)](https://www.bestpractices.dev/projects/13739)
4
4
 
5
- Use Xquik's typed Ruby client for X data and confirmed actions.
5
+ Use the Xquik Ruby SDK for Twitter search, timelines, profiles & followers.
6
+ Manage media, webhooks & X automation with typed requests.
7
+ Use documented Xquik REST routes as a Twitter API alternative.
6
8
 
7
- ## Documentation
9
+ [Ruby SDK Guide](https://docs.xquik.com/sdks/ruby) | [REST API](https://docs.xquik.com/api-reference/overview) | [RubyDoc](https://gemdocs.org/gems/x-twitter-scraper) | [Webhooks](https://docs.xquik.com/api-reference/webhooks/create)
8
10
 
9
- Read the [Ruby SDK guide](https://docs.xquik.com/sdks/ruby), [API guide](https://docs.xquik.com/api-reference/overview), or [RubyDoc reference](https://gemdocs.org/gems/x-twitter-scraper).
11
+ ## Common Twitter & X Tasks
10
12
 
11
- ## Choose the Ruby SDK
12
-
13
- Choose this gem for Ruby services using typed request objects and Sorbet.
14
- Reuse one client for connection pooling in threaded applications.
15
- Use the SDK guide for generated method names.
16
-
17
- ## Common X Data Tasks
18
-
19
- Use the linked Ruby reference for typed method names.
20
-
21
- | Customer Question | REST Route | Workflow Note |
13
+ | Task | REST Route | Usage |
22
14
  | --- | --- | --- |
23
- | How do I search tweets? | `GET /x/tweets/search` | Use keyword or advanced operator queries. |
24
- | How do I read a profile timeline? | `GET /x/users/{id}/tweets` | Paginate bounded results. |
25
- | How do I scrape followers? | `GET /x/users/{id}/followers` | Use an extraction for complete datasets. |
26
- | How do I scrape following accounts? | `GET /x/users/{id}/following` | Use an extraction for complete datasets. |
27
- | How do I read my home timeline? | `GET /x/timeline` | Approve this private read. |
28
- | How do I monitor an account? | `POST /monitors` | Deliver events through HMAC webhooks. |
29
- | How do I post or reply? | `POST /x/tweets` | Confirm the account and payload. |
15
+ | Search tweets without the X API | `GET /x/tweets/search` | Use keyword or advanced operator queries. |
16
+ | Read an X profile timeline | `GET /x/users/{id}/tweets` | Paginate bounded results. |
17
+ | Scrape Twitter followers | `GET /x/users/{id}/followers` | Use an extraction for complete datasets. |
18
+ | Scrape following accounts | `GET /x/users/{id}/following` | Use an extraction for complete datasets. |
19
+ | Read a home timeline | `GET /x/timeline` | Approve this private read. |
20
+ | Export large X datasets | `POST /extractions` | Poll status, then download results. |
21
+ | Download or upload media | `/x/media/*` | Use typed file helpers. |
22
+ | Monitor an account | `POST /monitors` | Deliver events through HMAC webhooks. |
23
+ | Post or reply | `POST /x/tweets` | Confirm the account and payload. |
30
24
 
31
25
  ## Installation
32
26
 
@@ -35,7 +29,7 @@ Add the gem to your `Gemfile`:
35
29
  <!-- x-release-please-start-version -->
36
30
 
37
31
  ```ruby
38
- gem "x-twitter-scraper", "~> 0.10.1"
32
+ gem "x-twitter-scraper", "~> 0.10.3"
39
33
  ```
40
34
 
41
35
  <!-- x-release-please-end -->
@@ -55,25 +49,25 @@ response = x_twitter_scraper.x.tweets.search(q: "from:elonmusk", limit: 10)
55
49
  puts(response)
56
50
  ```
57
51
 
58
- ### Handling errors
52
+ ### Handling Errors
59
53
 
60
- When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `XTwitterScraper::Errors::APIError` will be thrown:
54
+ The SDK raises an `APIError` subclass for connection failures and non-2xx responses:
61
55
 
62
56
  ```ruby
63
57
  begin
64
58
  account = x_twitter_scraper.account.retrieve
65
59
  rescue XTwitterScraper::Errors::APIConnectionError => e
66
- puts("The server could not be reached")
67
- puts(e.cause) # an underlying Exception, likely raised within `net/http`
60
+ puts("Could not reach the server. Check the connection.")
61
+ puts(e.cause) # Underlying net/http exception.
68
62
  rescue XTwitterScraper::Errors::RateLimitError => e
69
- puts("A 429 status code was received; we should back off a bit.")
63
+ puts("Rate limited. Retry later.")
70
64
  rescue XTwitterScraper::Errors::APIStatusError => e
71
- puts("Another non-200-range status code was received")
65
+ puts("Request failed. Inspect the returned HTTP status.")
72
66
  puts(e.status)
73
67
  end
74
68
  ```
75
69
 
76
- Error codes are as follows:
70
+ The SDK uses these error classes:
77
71
 
78
72
  | Cause | Error Type |
79
73
  | ---------------- | -------------------------- |
@@ -91,61 +85,53 @@ Error codes are as follows:
91
85
 
92
86
  ### Retries
93
87
 
94
- Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
95
-
96
- Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.
97
-
98
- You can use the `max_retries` option to configure or disable this:
88
+ The SDK retries connection errors, timeouts & HTTP 408, 409, 429, and 5xx responses.
89
+ It uses exponential backoff with 2 retries by default.
90
+ Set `max_retries` to change or disable retries:
99
91
 
100
92
  ```ruby
101
- # Configure the default for all requests:
93
+ # Set the client default:
102
94
  x_twitter_scraper = XTwitterScraper::Client.new(
103
95
  max_retries: 0 # default is 2
104
96
  )
105
97
 
106
- # Or, configure per-request:
98
+ # Override one request:
107
99
  x_twitter_scraper.account.retrieve(request_options: {max_retries: 5})
108
100
  ```
109
101
 
110
102
  ### Timeouts
111
103
 
112
- By default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:
104
+ Requests time out after 60 seconds. Set `timeout` to change or disable this limit:
113
105
 
114
106
  ```ruby
115
- # Configure the default for all requests:
107
+ # Set the client default:
116
108
  x_twitter_scraper = XTwitterScraper::Client.new(
117
109
  timeout: nil # default is 60
118
110
  )
119
111
 
120
- # Or, configure per-request:
112
+ # Override one request:
121
113
  x_twitter_scraper.account.retrieve(request_options: {timeout: 5})
122
114
  ```
123
115
 
124
- On timeout, `XTwitterScraper::Errors::APITimeoutError` is raised.
116
+ Timeouts raise `XTwitterScraper::Errors::APITimeoutError` and follow the retry policy.
125
117
 
126
- Note that requests that time out are retried by default.
127
-
128
- ## Advanced concepts
118
+ ## Advanced Concepts
129
119
 
130
120
  ### BaseModel
131
121
 
132
- All parameter and response objects inherit from `XTwitterScraper::Internal::Type::BaseModel`, which provides several conveniences, including:
133
-
134
- 1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.
135
-
136
- 2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.
137
-
138
- 3. Both instances and the classes themselves can be pretty-printed.
139
-
140
- 4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.
141
-
142
- ### Making custom or undocumented requests
122
+ All parameter and response objects inherit from `XTwitterScraper::Internal::Type::BaseModel`.
123
+ The base model provides these operations:
143
124
 
144
- #### Undocumented properties
125
+ 1. Access known and unknown fields with `obj[:prop]`.
126
+ 2. Destructure fields with `obj => {prop: prop}` or pattern matching.
127
+ 3. Compare objects by their field values with `==`.
128
+ 4. Print classes and instances in a readable format.
129
+ 5. Convert values with `#to_h`, `#deep_to_h`, `#to_json`, or `#to_yaml`.
145
130
 
146
- You can send undocumented parameters to any endpoint, and read undocumented response properties, like so:
131
+ ### Custom Requests
147
132
 
148
- Note: the `extra_` parameters of the same name overrides the documented parameters.
133
+ Use `extra_query`, `extra_body`, or `extra_headers` under `request_options`.
134
+ Matching `extra_` values override documented parameters.
149
135
 
150
136
  ```ruby
151
137
  account =
@@ -160,13 +146,7 @@ account =
160
146
  puts(account[:my_undocumented_property])
161
147
  ```
162
148
 
163
- #### Undocumented request params
164
-
165
- If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.
166
-
167
- #### Undocumented endpoints
168
-
169
- To make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:
149
+ Use `client.request` for undocumented endpoints while retaining authentication and retries:
170
150
 
171
151
  ```ruby
172
152
  response = client.request(
@@ -178,40 +158,32 @@ response = client.request(
178
158
  )
179
159
  ```
180
160
 
181
- ### Concurrency & connection pooling
182
-
183
- The `XTwitterScraper::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.
184
-
185
- Each instance of `XTwitterScraper::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.
186
-
187
- When all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.
161
+ ### Concurrency & Connection Pooling
188
162
 
189
- Unless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.
163
+ Clients are thread-safe. Fork them only when no HTTP requests are in flight.
164
+ Each client has an HTTP connection pool with a default size of 99.
165
+ Reuse one client per application in most cases.
166
+ Requests wait when every connection is busy. This wait counts toward the request timeout.
167
+ Other SDK classes do not lock their data.
190
168
 
191
169
  ## Sorbet
192
170
 
193
- The SDK includes [RBI](https://sorbet.org/docs/rbi) definitions. It does not depend on `sorbet-runtime`.
194
-
195
- You can provide typesafe request parameters like so:
196
-
197
- ```ruby
198
- x_twitter_scraper.x.tweets.search(q: "from:elonmusk", limit: 10)
199
- ```
171
+ The gem ships [RBI](https://sorbet.org/docs/rbi) definitions without `sorbet-runtime`.
200
172
 
201
- Or, equivalently:
173
+ Pass request hashes or typed parameter objects:
202
174
 
203
175
  ```ruby
204
- # Hashes work, but are not typesafe:
176
+ # Hashes work without type safety:
205
177
  x_twitter_scraper.x.tweets.search(q: "from:elonmusk", limit: 10)
206
178
 
207
- # You can also splat a full Params class:
179
+ # Splat a complete Params object:
208
180
  params = XTwitterScraper::X::TweetSearchParams.new(q: "from:elonmusk", limit: 10)
209
181
  x_twitter_scraper.x.tweets.search(**params)
210
182
  ```
211
183
 
212
184
  ### Enums
213
185
 
214
- Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
186
+ Tagged symbols replace [`T::Enum`](https://sorbet.org/docs/tenum) and remain runtime primitives:
215
187
 
216
188
  ```ruby
217
189
  # :en
@@ -221,16 +193,16 @@ puts(XTwitterScraper::AccountUpdateLocaleParams::Locale::EN)
221
193
  T.reveal_type(XTwitterScraper::AccountUpdateLocaleParams::Locale::EN)
222
194
  ```
223
195
 
224
- Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
196
+ Enum parameters accept constants or literal values:
225
197
 
226
198
  ```ruby
227
- # Using the enum constants preserves the tagged type information:
199
+ # Enum constants preserve tagged type information:
228
200
  x_twitter_scraper.account.update_locale(
229
201
  locale: XTwitterScraper::AccountUpdateLocaleParams::Locale::EN,
230
202
  # …
231
203
  )
232
204
 
233
- # Literal values are also permissible:
205
+ # Literal values also work:
234
206
  x_twitter_scraper.account.update_locale(
235
207
  locale: :en,
236
208
  # …
@@ -239,9 +211,9 @@ x_twitter_scraper.account.update_locale(
239
211
 
240
212
  ## Versioning
241
213
 
242
- This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.
214
+ This package follows [SemVer](https://semver.org/spec/v2.0.0.html). Version `0` releases may change APIs.
243
215
 
244
- This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.
216
+ Changes to non-runtime `*.rbi` and `*.rbs` definitions remain non-breaking.
245
217
 
246
218
  ## Requirements
247
219
 
@@ -254,6 +226,6 @@ Ruby 3.2.0 or higher.
254
226
 
255
227
  ## Contributing
256
228
 
257
- See [the contributing documentation](https://github.com/Xquik-dev/x-twitter-scraper-ruby/tree/main/CONTRIBUTING.md).
229
+ Read the [contribution guide](CONTRIBUTING.md).
258
230
 
259
231
  Xquik is an independent third-party service. Not affiliated with X Corp. "Twitter" and "X" are trademarks of X Corp.
data/SECURITY.md CHANGED
@@ -12,8 +12,8 @@ Report vulnerabilities privately through
12
12
  Do not open public issues for secrets, credential handling defects, private
13
13
  data exposure, or package supply-chain concerns.
14
14
 
15
- We aim to acknowledge reports within 3 business days. We will coordinate a
16
- disclosure timeline after confirming the issue.
15
+ Maintainers acknowledge reports within 3 business days.
16
+ We coordinate disclosure after confirming the issue.
17
17
 
18
18
  ## Scope
19
19
 
@@ -5,5 +5,5 @@
5
5
  # frozen_string_literal: true
6
6
 
7
7
  module XTwitterScraper
8
- VERSION = "0.10.1"
8
+ VERSION = "0.10.3"
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: x-twitter-scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xquik
@@ -972,5 +972,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
972
972
  requirements: []
973
973
  rubygems_version: 4.0.16
974
974
  specification_version: 4
975
- summary: Ruby SDK for the Xquik API
975
+ summary: Ruby SDK for Twitter search, followers, webhooks & X automation. Not affiliated
976
+ with X Corp.
976
977
  test_files: []