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 +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +62 -90
- data/SECURITY.md +2 -2
- data/lib/x_twitter_scraper/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 377c00b19b9d19ebb8a350b172937dc5805869f1e7d500da6ec4fec43996d659
|
|
4
|
+
data.tar.gz: e57a1128b31495941ff65b3418c059d64c2afb3d7ae69de55b1ce45937a73c59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
#
|
|
1
|
+
# Xquik Ruby SDK: Twitter Search, Followers & X Automation
|
|
2
2
|
|
|
3
3
|
[](https://www.bestpractices.dev/projects/13739)
|
|
4
4
|
|
|
5
|
-
Use Xquik
|
|
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
|
-
|
|
11
|
+
## Common Twitter & X Tasks
|
|
10
12
|
|
|
11
|
-
|
|
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
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
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.
|
|
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
|
|
52
|
+
### Handling Errors
|
|
59
53
|
|
|
60
|
-
|
|
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("
|
|
67
|
-
puts(e.cause) #
|
|
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("
|
|
63
|
+
puts("Rate limited. Retry later.")
|
|
70
64
|
rescue XTwitterScraper::Errors::APIStatusError => e
|
|
71
|
-
puts("
|
|
65
|
+
puts("Request failed. Inspect the returned HTTP status.")
|
|
72
66
|
puts(e.status)
|
|
73
67
|
end
|
|
74
68
|
```
|
|
75
69
|
|
|
76
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
|
|
104
|
+
Requests time out after 60 seconds. Set `timeout` to change or disable this limit:
|
|
113
105
|
|
|
114
106
|
```ruby
|
|
115
|
-
#
|
|
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
|
-
#
|
|
112
|
+
# Override one request:
|
|
121
113
|
x_twitter_scraper.account.retrieve(request_options: {timeout: 5})
|
|
122
114
|
```
|
|
123
115
|
|
|
124
|
-
|
|
116
|
+
Timeouts raise `XTwitterScraper::Errors::APITimeoutError` and follow the retry policy.
|
|
125
117
|
|
|
126
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
131
|
+
### Custom Requests
|
|
147
132
|
|
|
148
|
-
|
|
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
|
-
|
|
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 &
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
173
|
+
Pass request hashes or typed parameter objects:
|
|
202
174
|
|
|
203
175
|
```ruby
|
|
204
|
-
# Hashes work
|
|
176
|
+
# Hashes work without type safety:
|
|
205
177
|
x_twitter_scraper.x.tweets.search(q: "from:elonmusk", limit: 10)
|
|
206
178
|
|
|
207
|
-
#
|
|
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
|
-
|
|
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
|
|
196
|
+
Enum parameters accept constants or literal values:
|
|
225
197
|
|
|
226
198
|
```ruby
|
|
227
|
-
#
|
|
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
|
|
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)
|
|
214
|
+
This package follows [SemVer](https://semver.org/spec/v2.0.0.html). Version `0` releases may change APIs.
|
|
243
215
|
|
|
244
|
-
|
|
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
|
-
|
|
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
|
-
|
|
16
|
-
disclosure
|
|
15
|
+
Maintainers acknowledge reports within 3 business days.
|
|
16
|
+
We coordinate disclosure after confirming the issue.
|
|
17
17
|
|
|
18
18
|
## Scope
|
|
19
19
|
|
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.
|
|
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
|
|
975
|
+
summary: Ruby SDK for Twitter search, followers, webhooks & X automation. Not affiliated
|
|
976
|
+
with X Corp.
|
|
976
977
|
test_files: []
|