x-twitter-scraper 0.10.2 → 0.10.4
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 +4 -4
- data/CHANGELOG.md +20 -2
- data/README.md +30 -56
- data/SECURITY.md +3 -3
- data/lib/x_twitter_scraper/internal/type/base_model.rb +2 -2
- data/lib/x_twitter_scraper/internal/type/enum.rb +1 -2
- data/lib/x_twitter_scraper/request_options.rb +2 -4
- data/lib/x_twitter_scraper/version.rb +1 -1
- data/rbi/x_twitter_scraper/request_options.rbi +2 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f4f7490097e2a6d503e322f7cc58ad97ee1969eb5d63630b51cabba1e1475fa
|
|
4
|
+
data.tar.gz: e4d5168613a265fda0cf590313d0f636dad69fdde68cf01a62b117bc74669830
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 25f7299ef958d3305df6f392af953a70b87aa1ae639486a90416e49c84fe27faaddd6472f4ba42349c6daf71353143f5a54026904321be69c115abbf63e93fdd
|
|
7
|
+
data.tar.gz: b34e28eba91790af3eb1e585156557ffd631fefd835cc9b1d84b5a8a35e7b81c7b78a8e1a0d7bcbc08e5db872ec2295b1866fede239f4a634d5005450fd09d43
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.4 (2026-08-21)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.10.3...v0.10.4](https://github.com/Xquik-dev/x-twitter-scraper-ruby/compare/v0.10.3...v0.10.4)
|
|
6
|
+
|
|
7
|
+
### Documentation
|
|
8
|
+
|
|
9
|
+
* Remove repeated SDK copy and repair public links.
|
|
10
|
+
|
|
11
|
+
## 0.10.3 (2026-08-21)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.10.2...v0.10.3](https://github.com/Xquik-dev/x-twitter-scraper-ruby/compare/v0.10.2...v0.10.3)
|
|
14
|
+
|
|
15
|
+
### Documentation
|
|
16
|
+
|
|
17
|
+
* tighten SDK and contribution guidance
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
|
|
21
|
+
* simplify repository comments and formatter output
|
|
22
|
+
|
|
3
23
|
## 0.10.2 (2026-08-20)
|
|
4
24
|
|
|
5
25
|
Full Changelog: [v0.10.1...v0.10.2](https://github.com/Xquik-dev/x-twitter-scraper-ruby/compare/v0.10.1...v0.10.2)
|
|
@@ -261,8 +281,6 @@ Full Changelog: [v0.1.0...v0.2.0](https://github.com/Xquik-dev/x-twitter-scraper
|
|
|
261
281
|
|
|
262
282
|
## 0.1.0 (2026-03-30)
|
|
263
283
|
|
|
264
|
-
Full Changelog: [v0.0.1...v0.1.0](https://github.com/Xquik-dev/x-twitter-scraper-ruby/compare/v0.0.1...v0.1.0)
|
|
265
|
-
|
|
266
284
|
### Features
|
|
267
285
|
|
|
268
286
|
* **api:** api update ([772ffdd](https://github.com/Xquik-dev/x-twitter-scraper-ruby/commit/772ffdd682ee96f94334441b9fc5b1e109559993))
|
data/README.md
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
# Xquik Ruby SDK: Twitter
|
|
1
|
+
# Xquik Ruby SDK: Twitter search, followers & X automation
|
|
2
2
|
|
|
3
3
|
[](https://www.bestpractices.dev/projects/13739)
|
|
4
4
|
|
|
5
|
-
Use the Xquik Ruby SDK for Twitter search, timelines, profiles & followers.
|
|
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
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
|
-
##
|
|
10
|
-
|
|
11
|
-
Choose this gem for Ruby services that use Sorbet or RBS. Reuse one client for pooled connections.
|
|
12
|
-
|
|
13
|
-
## Common Twitter & X Tasks
|
|
14
|
-
|
|
15
|
-
Map each task to its REST route.
|
|
11
|
+
## Common Twitter & X tasks
|
|
16
12
|
|
|
17
13
|
| Task | REST Route | Usage |
|
|
18
14
|
| --- | --- | --- |
|
|
@@ -28,12 +24,14 @@ Map each task to its REST route.
|
|
|
28
24
|
|
|
29
25
|
## Installation
|
|
30
26
|
|
|
27
|
+
Requires Ruby 3.2.0 or higher.
|
|
28
|
+
|
|
31
29
|
Add the gem to your `Gemfile`:
|
|
32
30
|
|
|
33
31
|
<!-- x-release-please-start-version -->
|
|
34
32
|
|
|
35
33
|
```ruby
|
|
36
|
-
gem "x-twitter-scraper", "~> 0.10.
|
|
34
|
+
gem "x-twitter-scraper", "~> 0.10.4"
|
|
37
35
|
```
|
|
38
36
|
|
|
39
37
|
<!-- x-release-please-end -->
|
|
@@ -45,7 +43,7 @@ require "bundler/setup"
|
|
|
45
43
|
require "x_twitter_scraper"
|
|
46
44
|
|
|
47
45
|
x_twitter_scraper = XTwitterScraper::Client.new(
|
|
48
|
-
api_key: ENV["X_TWITTER_SCRAPER_API_KEY"] #
|
|
46
|
+
api_key: ENV["X_TWITTER_SCRAPER_API_KEY"] # Optional; the client reads this variable.
|
|
49
47
|
)
|
|
50
48
|
|
|
51
49
|
response = x_twitter_scraper.x.tweets.search(q: "from:elonmusk", limit: 10)
|
|
@@ -53,7 +51,7 @@ response = x_twitter_scraper.x.tweets.search(q: "from:elonmusk", limit: 10)
|
|
|
53
51
|
puts(response)
|
|
54
52
|
```
|
|
55
53
|
|
|
56
|
-
### Handling
|
|
54
|
+
### Handling errors
|
|
57
55
|
|
|
58
56
|
The SDK raises an `APIError` subclass for connection failures and non-2xx responses:
|
|
59
57
|
|
|
@@ -66,13 +64,11 @@ rescue XTwitterScraper::Errors::APIConnectionError => e
|
|
|
66
64
|
rescue XTwitterScraper::Errors::RateLimitError => e
|
|
67
65
|
puts("Rate limited. Retry later.")
|
|
68
66
|
rescue XTwitterScraper::Errors::APIStatusError => e
|
|
69
|
-
puts("
|
|
67
|
+
puts("Request failed. Inspect the returned HTTP status.")
|
|
70
68
|
puts(e.status)
|
|
71
69
|
end
|
|
72
70
|
```
|
|
73
71
|
|
|
74
|
-
The SDK uses these error classes:
|
|
75
|
-
|
|
76
72
|
| Cause | Error Type |
|
|
77
73
|
| ---------------- | -------------------------- |
|
|
78
74
|
| HTTP 400 | `BadRequestError` |
|
|
@@ -89,17 +85,17 @@ The SDK uses these error classes:
|
|
|
89
85
|
|
|
90
86
|
### Retries
|
|
91
87
|
|
|
92
|
-
The SDK retries connection errors, timeouts
|
|
93
|
-
It uses exponential backoff
|
|
88
|
+
The SDK retries connection errors, timeouts & HTTP 408, 409, 429, and 5xx responses.
|
|
89
|
+
It uses exponential backoff with 2 retries by default.
|
|
94
90
|
Set `max_retries` to change or disable retries:
|
|
95
91
|
|
|
96
92
|
```ruby
|
|
97
|
-
#
|
|
93
|
+
# Change the client default.
|
|
98
94
|
x_twitter_scraper = XTwitterScraper::Client.new(
|
|
99
|
-
max_retries: 0
|
|
95
|
+
max_retries: 0
|
|
100
96
|
)
|
|
101
97
|
|
|
102
|
-
# Override one request
|
|
98
|
+
# Override one request.
|
|
103
99
|
x_twitter_scraper.account.retrieve(request_options: {max_retries: 5})
|
|
104
100
|
```
|
|
105
101
|
|
|
@@ -108,25 +104,20 @@ x_twitter_scraper.account.retrieve(request_options: {max_retries: 5})
|
|
|
108
104
|
Requests time out after 60 seconds. Set `timeout` to change or disable this limit:
|
|
109
105
|
|
|
110
106
|
```ruby
|
|
111
|
-
#
|
|
107
|
+
# Change the client default.
|
|
112
108
|
x_twitter_scraper = XTwitterScraper::Client.new(
|
|
113
|
-
timeout: nil
|
|
109
|
+
timeout: nil
|
|
114
110
|
)
|
|
115
111
|
|
|
116
|
-
# Override one request
|
|
112
|
+
# Override one request.
|
|
117
113
|
x_twitter_scraper.account.retrieve(request_options: {timeout: 5})
|
|
118
114
|
```
|
|
119
115
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
Timed-out requests follow the default retry policy.
|
|
116
|
+
Timeouts raise `XTwitterScraper::Errors::APITimeoutError` and follow the retry policy.
|
|
123
117
|
|
|
124
|
-
##
|
|
118
|
+
## BaseModel
|
|
125
119
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
All parameter and response objects inherit from `XTwitterScraper::Internal::Type::BaseModel`.
|
|
129
|
-
The base model provides these operations:
|
|
120
|
+
All parameter and response objects inherit from `XTwitterScraper::Internal::Type::BaseModel` and support:
|
|
130
121
|
|
|
131
122
|
1. Access known and unknown fields with `obj[:prop]`.
|
|
132
123
|
2. Destructure fields with `obj => {prop: prop}` or pattern matching.
|
|
@@ -134,13 +125,10 @@ The base model provides these operations:
|
|
|
134
125
|
4. Print classes and instances in a readable format.
|
|
135
126
|
5. Convert values with `#to_h`, `#deep_to_h`, `#to_json`, or `#to_yaml`.
|
|
136
127
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
#### Undocumented Properties
|
|
128
|
+
## Custom requests
|
|
140
129
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
A matching `extra_` option overrides its documented parameter.
|
|
130
|
+
Use `extra_query`, `extra_body`, or `extra_headers` under `request_options`.
|
|
131
|
+
Matching `extra_` values override documented parameters.
|
|
144
132
|
|
|
145
133
|
```ruby
|
|
146
134
|
account =
|
|
@@ -155,12 +143,6 @@ account =
|
|
|
155
143
|
puts(account[:my_undocumented_property])
|
|
156
144
|
```
|
|
157
145
|
|
|
158
|
-
#### Undocumented Request Parameters
|
|
159
|
-
|
|
160
|
-
Pass extra values through `extra_query`, `extra_body`, or `extra_headers` under `request_options:`.
|
|
161
|
-
|
|
162
|
-
#### Undocumented Endpoints
|
|
163
|
-
|
|
164
146
|
Use `client.request` for undocumented endpoints while retaining authentication and retries:
|
|
165
147
|
|
|
166
148
|
```ruby
|
|
@@ -173,7 +155,7 @@ response = client.request(
|
|
|
173
155
|
)
|
|
174
156
|
```
|
|
175
157
|
|
|
176
|
-
|
|
158
|
+
## Concurrency & connection pooling
|
|
177
159
|
|
|
178
160
|
Clients are thread-safe. Fork them only when no HTTP requests are in flight.
|
|
179
161
|
Each client has an HTTP connection pool with a default size of 99.
|
|
@@ -183,7 +165,7 @@ Other SDK classes do not lock their data.
|
|
|
183
165
|
|
|
184
166
|
## Sorbet
|
|
185
167
|
|
|
186
|
-
The
|
|
168
|
+
The gem ships [RBI](https://sorbet.org/docs/rbi) definitions without `sorbet-runtime`.
|
|
187
169
|
|
|
188
170
|
Pass request hashes or typed parameter objects:
|
|
189
171
|
|
|
@@ -198,8 +180,7 @@ x_twitter_scraper.x.tweets.search(**params)
|
|
|
198
180
|
|
|
199
181
|
### Enums
|
|
200
182
|
|
|
201
|
-
|
|
202
|
-
It uses tagged symbols, which remain primitives at runtime:
|
|
183
|
+
Tagged symbols replace [`T::Enum`](https://sorbet.org/docs/tenum) and remain runtime primitives:
|
|
203
184
|
|
|
204
185
|
```ruby
|
|
205
186
|
# :en
|
|
@@ -231,17 +212,10 @@ This package follows [SemVer](https://semver.org/spec/v2.0.0.html). Version `0`
|
|
|
231
212
|
|
|
232
213
|
Changes to non-runtime `*.rbi` and `*.rbs` definitions remain non-breaking.
|
|
233
214
|
|
|
234
|
-
##
|
|
235
|
-
|
|
236
|
-
Ruby 3.2.0 or higher.
|
|
237
|
-
|
|
238
|
-
## Security & Support
|
|
215
|
+
## Help & contributing
|
|
239
216
|
|
|
240
217
|
- Report vulnerabilities through the [security policy](SECURITY.md).
|
|
241
218
|
- Ask usage questions through the [organization support policy](https://github.com/Xquik-dev/.github/blob/main/SUPPORT.md).
|
|
242
|
-
|
|
243
|
-
## Contributing
|
|
244
|
-
|
|
245
|
-
See [the contributing documentation](https://github.com/Xquik-dev/x-twitter-scraper-ruby/tree/main/CONTRIBUTING.md).
|
|
219
|
+
- Read the [contribution guide](CONTRIBUTING.md).
|
|
246
220
|
|
|
247
221
|
Xquik is an independent third-party service. Not affiliated with X Corp. "Twitter" and "X" are trademarks of X Corp.
|
data/SECURITY.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Security
|
|
1
|
+
# Security policy
|
|
2
2
|
|
|
3
|
-
## Supported
|
|
3
|
+
## Supported versions
|
|
4
4
|
|
|
5
5
|
Security fixes target the latest published release.
|
|
6
6
|
|
|
7
|
-
## Reporting
|
|
7
|
+
## Reporting a vulnerability
|
|
8
8
|
|
|
9
9
|
Report vulnerabilities privately through
|
|
10
10
|
[support@xquik.com](mailto:support@xquik.com).
|
|
@@ -403,8 +403,8 @@ module XTwitterScraper
|
|
|
403
403
|
# Returns the raw value associated with the given key, if found. Otherwise, nil is
|
|
404
404
|
# returned.
|
|
405
405
|
#
|
|
406
|
-
#
|
|
407
|
-
#
|
|
406
|
+
# You may look up keys absent from the API spec, such as undocumented response fields.
|
|
407
|
+
# This method does not parse response data into
|
|
408
408
|
# higher-level types. Lookup by anything other than a Symbol is an ArgumentError.
|
|
409
409
|
#
|
|
410
410
|
# @param key [Symbol]
|
|
@@ -78,8 +78,7 @@ module XTwitterScraper
|
|
|
78
78
|
|
|
79
79
|
# @api private
|
|
80
80
|
#
|
|
81
|
-
# Unlike
|
|
82
|
-
# of the enum.
|
|
81
|
+
# Unlike primitives, `Enum` validates membership.
|
|
83
82
|
#
|
|
84
83
|
# @param value [String, Symbol, Object]
|
|
85
84
|
#
|
|
@@ -37,16 +37,14 @@ module XTwitterScraper
|
|
|
37
37
|
optional :idempotency_key, String
|
|
38
38
|
|
|
39
39
|
# @!attribute extra_query
|
|
40
|
-
# Extra query params
|
|
41
|
-
# `query` given at the client level.
|
|
40
|
+
# Extra query params merge into any `query` given at the client level.
|
|
42
41
|
#
|
|
43
42
|
# @return [Hash{String=>Array<String>, String, nil}, nil]
|
|
44
43
|
optional :extra_query,
|
|
45
44
|
XTwitterScraper::Internal::Type::HashOf[XTwitterScraper::Internal::Type::ArrayOf[String]]
|
|
46
45
|
|
|
47
46
|
# @!attribute extra_headers
|
|
48
|
-
# Extra headers
|
|
49
|
-
# `extra_headers` given at the client level.
|
|
47
|
+
# Extra headers merge into any `extra_headers` given at the client level.
|
|
50
48
|
#
|
|
51
49
|
# @return [Hash{String=>String, nil}, nil]
|
|
52
50
|
optional :extra_headers, XTwitterScraper::Internal::Type::HashOf[String, nil?: true]
|
|
@@ -29,8 +29,7 @@ module XTwitterScraper
|
|
|
29
29
|
sig { returns(T.nilable(String)) }
|
|
30
30
|
attr_accessor :idempotency_key
|
|
31
31
|
|
|
32
|
-
# Extra query params
|
|
33
|
-
# `query` given at the client level.
|
|
32
|
+
# Extra query params merge into any `query` given at the client level.
|
|
34
33
|
sig do
|
|
35
34
|
returns(
|
|
36
35
|
T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))])
|
|
@@ -38,8 +37,7 @@ module XTwitterScraper
|
|
|
38
37
|
end
|
|
39
38
|
attr_accessor :extra_query
|
|
40
39
|
|
|
41
|
-
# Extra headers
|
|
42
|
-
# `extra_headers` given at the client level.
|
|
40
|
+
# Extra headers merge into any `extra_headers` given at the client level.
|
|
43
41
|
sig { returns(T.nilable(T::Hash[String, T.nilable(String)])) }
|
|
44
42
|
attr_accessor :extra_headers
|
|
45
43
|
|