web2cli 0.2.0__py3-none-any.whl
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.
- web2cli/__init__.py +3 -0
- web2cli/__main__.py +5 -0
- web2cli/adapter/__init__.py +0 -0
- web2cli/adapter/lint.py +667 -0
- web2cli/adapter/loader.py +157 -0
- web2cli/adapter/validator.py +127 -0
- web2cli/adapters/discord.com/web2cli.yaml +476 -0
- web2cli/adapters/mail.google.com/parsers/inbox.py +200 -0
- web2cli/adapters/mail.google.com/web2cli.yaml +52 -0
- web2cli/adapters/news.ycombinator.com/web2cli.yaml +356 -0
- web2cli/adapters/reddit.com/web2cli.yaml +233 -0
- web2cli/adapters/slack.com/web2cli.yaml +445 -0
- web2cli/adapters/stackoverflow.com/web2cli.yaml +257 -0
- web2cli/adapters/x.com/providers/x_graphql.py +299 -0
- web2cli/adapters/x.com/web2cli.yaml +449 -0
- web2cli/auth/__init__.py +0 -0
- web2cli/auth/browser_login.py +820 -0
- web2cli/auth/manager.py +166 -0
- web2cli/auth/store.py +68 -0
- web2cli/cli.py +1286 -0
- web2cli/executor/__init__.py +0 -0
- web2cli/executor/http.py +113 -0
- web2cli/output/__init__.py +0 -0
- web2cli/output/formatter.py +116 -0
- web2cli/parser/__init__.py +0 -0
- web2cli/parser/custom.py +21 -0
- web2cli/parser/html_parser.py +111 -0
- web2cli/parser/transforms.py +127 -0
- web2cli/pipe.py +10 -0
- web2cli/providers/__init__.py +6 -0
- web2cli/providers/base.py +22 -0
- web2cli/providers/registry.py +86 -0
- web2cli/runtime/__init__.py +1 -0
- web2cli/runtime/cache.py +42 -0
- web2cli/runtime/engine.py +743 -0
- web2cli/runtime/parser.py +398 -0
- web2cli/runtime/template.py +52 -0
- web2cli/types.py +71 -0
- web2cli-0.2.0.dist-info/METADATA +467 -0
- web2cli-0.2.0.dist-info/RECORD +44 -0
- web2cli-0.2.0.dist-info/WHEEL +5 -0
- web2cli-0.2.0.dist-info/entry_points.txt +2 -0
- web2cli-0.2.0.dist-info/licenses/LICENSE +202 -0
- web2cli-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
meta:
|
|
2
|
+
spec_version: "0.2"
|
|
3
|
+
name: x
|
|
4
|
+
domain: x.com
|
|
5
|
+
base_url: https://x.com/i/api/graphql
|
|
6
|
+
version: 0.2.0
|
|
7
|
+
description: "X (Twitter) — tweets, profiles"
|
|
8
|
+
author: web2cli-core
|
|
9
|
+
transport: http
|
|
10
|
+
impersonate: chrome
|
|
11
|
+
aliases:
|
|
12
|
+
- x
|
|
13
|
+
- twitter
|
|
14
|
+
default_headers:
|
|
15
|
+
User-Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"
|
|
16
|
+
Accept: "*/*"
|
|
17
|
+
Content-Type: "application/json"
|
|
18
|
+
|
|
19
|
+
auth:
|
|
20
|
+
methods:
|
|
21
|
+
- type: cookies
|
|
22
|
+
keys: ["auth_token", "ct0"]
|
|
23
|
+
env_var: WEB2CLI_X_COOKIES
|
|
24
|
+
|
|
25
|
+
commands:
|
|
26
|
+
tweet:
|
|
27
|
+
description: "Get a single tweet by ID or URL"
|
|
28
|
+
args:
|
|
29
|
+
id:
|
|
30
|
+
type: string
|
|
31
|
+
required: true
|
|
32
|
+
source: [arg, stdin]
|
|
33
|
+
description: "Tweet ID or URL"
|
|
34
|
+
pipeline:
|
|
35
|
+
- request:
|
|
36
|
+
name: fetch
|
|
37
|
+
provider: x_graphql
|
|
38
|
+
use_transaction: false
|
|
39
|
+
operation: TweetDetail
|
|
40
|
+
variables:
|
|
41
|
+
focalTweetId: "{{args.id}}"
|
|
42
|
+
with_rux_injections: false
|
|
43
|
+
rankingMode: Relevance
|
|
44
|
+
includePromotedContent: true
|
|
45
|
+
withCommunity: true
|
|
46
|
+
withQuickPromoteEligibilityTweetFields: true
|
|
47
|
+
withBirdwatchNotes: true
|
|
48
|
+
withVoice: true
|
|
49
|
+
- parse:
|
|
50
|
+
name: parsed
|
|
51
|
+
from: fetch
|
|
52
|
+
format: json
|
|
53
|
+
extract: "$.data.threaded_conversation_with_injections_v2.instructions[].entries[].content.itemContent.tweet_results.result"
|
|
54
|
+
fields:
|
|
55
|
+
- name: id
|
|
56
|
+
from:
|
|
57
|
+
coalesce:
|
|
58
|
+
- "$.tweet.result.legacy.id_str"
|
|
59
|
+
- "$.tweet.legacy.id_str"
|
|
60
|
+
- "$.legacy.id_str"
|
|
61
|
+
- name: author
|
|
62
|
+
from:
|
|
63
|
+
coalesce:
|
|
64
|
+
- "$.tweet.result.core.user_results.result.core.screen_name"
|
|
65
|
+
- "$.tweet.core.user_results.result.core.screen_name"
|
|
66
|
+
- "$.core.user_results.result.core.screen_name"
|
|
67
|
+
- "$.tweet.result.core.user_results.result.legacy.screen_name"
|
|
68
|
+
- "$.tweet.core.user_results.result.legacy.screen_name"
|
|
69
|
+
- "$.core.user_results.result.legacy.screen_name"
|
|
70
|
+
ops:
|
|
71
|
+
- template:
|
|
72
|
+
value: "@{{value}}"
|
|
73
|
+
- name: name
|
|
74
|
+
from:
|
|
75
|
+
coalesce:
|
|
76
|
+
- "$.tweet.result.core.user_results.result.core.name"
|
|
77
|
+
- "$.tweet.core.user_results.result.core.name"
|
|
78
|
+
- "$.core.user_results.result.core.name"
|
|
79
|
+
- "$.tweet.result.core.user_results.result.legacy.name"
|
|
80
|
+
- "$.tweet.core.user_results.result.legacy.name"
|
|
81
|
+
- "$.core.user_results.result.legacy.name"
|
|
82
|
+
- name: text
|
|
83
|
+
from:
|
|
84
|
+
coalesce:
|
|
85
|
+
- "$.tweet.result.legacy.full_text"
|
|
86
|
+
- "$.tweet.legacy.full_text"
|
|
87
|
+
- "$.legacy.full_text"
|
|
88
|
+
- name: date
|
|
89
|
+
from:
|
|
90
|
+
coalesce:
|
|
91
|
+
- "$.tweet.result.legacy.created_at"
|
|
92
|
+
- "$.tweet.legacy.created_at"
|
|
93
|
+
- "$.legacy.created_at"
|
|
94
|
+
transform: x_datetime
|
|
95
|
+
- name: retweets
|
|
96
|
+
from:
|
|
97
|
+
coalesce:
|
|
98
|
+
- "$.tweet.result.legacy.retweet_count"
|
|
99
|
+
- "$.tweet.legacy.retweet_count"
|
|
100
|
+
- "$.legacy.retweet_count"
|
|
101
|
+
- name: likes
|
|
102
|
+
from:
|
|
103
|
+
coalesce:
|
|
104
|
+
- "$.tweet.result.legacy.favorite_count"
|
|
105
|
+
- "$.tweet.legacy.favorite_count"
|
|
106
|
+
- "$.legacy.favorite_count"
|
|
107
|
+
- name: replies
|
|
108
|
+
from:
|
|
109
|
+
coalesce:
|
|
110
|
+
- "$.tweet.result.legacy.reply_count"
|
|
111
|
+
- "$.tweet.legacy.reply_count"
|
|
112
|
+
- "$.legacy.reply_count"
|
|
113
|
+
- name: views
|
|
114
|
+
from:
|
|
115
|
+
coalesce:
|
|
116
|
+
- "$.tweet.result.views.count"
|
|
117
|
+
- "$.tweet.views.count"
|
|
118
|
+
- "$.views.count"
|
|
119
|
+
- name: url
|
|
120
|
+
from:
|
|
121
|
+
coalesce:
|
|
122
|
+
- "$.tweet.result.legacy.id_str"
|
|
123
|
+
- "$.tweet.legacy.id_str"
|
|
124
|
+
- "$.legacy.id_str"
|
|
125
|
+
template: "https://x.com/i/status/{{value}}"
|
|
126
|
+
post_ops:
|
|
127
|
+
- filter_not_empty: text
|
|
128
|
+
- limit: 1
|
|
129
|
+
output:
|
|
130
|
+
from_step: parsed
|
|
131
|
+
default_fields: [author, text, date, retweets, likes, replies, views]
|
|
132
|
+
default_format: table
|
|
133
|
+
|
|
134
|
+
profile:
|
|
135
|
+
description: "Get user profile info"
|
|
136
|
+
args:
|
|
137
|
+
user:
|
|
138
|
+
type: string
|
|
139
|
+
required: true
|
|
140
|
+
source: [arg, stdin]
|
|
141
|
+
description: "Username (e.g. @michaloblak)"
|
|
142
|
+
pipeline:
|
|
143
|
+
- request:
|
|
144
|
+
name: fetch
|
|
145
|
+
provider: x_graphql
|
|
146
|
+
use_transaction: false
|
|
147
|
+
operation: UserByScreenName
|
|
148
|
+
variables:
|
|
149
|
+
screen_name: "{{args.user}}"
|
|
150
|
+
withSafetyModeUserFields: true
|
|
151
|
+
- parse:
|
|
152
|
+
name: parsed
|
|
153
|
+
from: fetch
|
|
154
|
+
format: json
|
|
155
|
+
extract: "$.data.user.result"
|
|
156
|
+
fields:
|
|
157
|
+
- name: handle
|
|
158
|
+
from: "$.core.screen_name"
|
|
159
|
+
ops:
|
|
160
|
+
- template:
|
|
161
|
+
value: "@{{value}}"
|
|
162
|
+
- name: name
|
|
163
|
+
from: "$.core.name"
|
|
164
|
+
- name: bio
|
|
165
|
+
from: "$.legacy.description"
|
|
166
|
+
- name: followers
|
|
167
|
+
from: "$.legacy.followers_count"
|
|
168
|
+
- name: following
|
|
169
|
+
from: "$.legacy.friends_count"
|
|
170
|
+
- name: tweets
|
|
171
|
+
from: "$.legacy.statuses_count"
|
|
172
|
+
- name: likes
|
|
173
|
+
from: "$.legacy.favourites_count"
|
|
174
|
+
- name: joined
|
|
175
|
+
from: "$.core.created_at"
|
|
176
|
+
transform: x_date
|
|
177
|
+
- name: verified
|
|
178
|
+
from: "$.is_blue_verified"
|
|
179
|
+
- name: location
|
|
180
|
+
from: "$.legacy.location"
|
|
181
|
+
output:
|
|
182
|
+
from_step: parsed
|
|
183
|
+
default_fields: [handle, name, bio, followers, following, tweets, joined]
|
|
184
|
+
default_format: table
|
|
185
|
+
|
|
186
|
+
search:
|
|
187
|
+
description: "Search tweets"
|
|
188
|
+
args:
|
|
189
|
+
query:
|
|
190
|
+
type: string
|
|
191
|
+
required: true
|
|
192
|
+
source: [arg, stdin]
|
|
193
|
+
description: "Search query"
|
|
194
|
+
limit:
|
|
195
|
+
type: int
|
|
196
|
+
required: false
|
|
197
|
+
default: 20
|
|
198
|
+
description: "Number of results"
|
|
199
|
+
product:
|
|
200
|
+
type: string
|
|
201
|
+
required: false
|
|
202
|
+
default: Latest
|
|
203
|
+
description: "Search tab: Latest, Top, People, Media"
|
|
204
|
+
pipeline:
|
|
205
|
+
- request:
|
|
206
|
+
name: fetch
|
|
207
|
+
provider: x_graphql
|
|
208
|
+
operation: SearchTimeline
|
|
209
|
+
variables:
|
|
210
|
+
rawQuery: "{{args.query}}"
|
|
211
|
+
count: "{{args.limit}}"
|
|
212
|
+
querySource: typed_query
|
|
213
|
+
product: "{{args.product}}"
|
|
214
|
+
- parse:
|
|
215
|
+
name: parsed
|
|
216
|
+
from: fetch
|
|
217
|
+
format: json
|
|
218
|
+
extract: "$.data.search_by_raw_query.search_timeline.timeline.instructions[].entries[].content.itemContent.tweet_results.result"
|
|
219
|
+
fields:
|
|
220
|
+
- name: id
|
|
221
|
+
from:
|
|
222
|
+
coalesce:
|
|
223
|
+
- "$.tweet.legacy.id_str"
|
|
224
|
+
- "$.legacy.id_str"
|
|
225
|
+
- name: author
|
|
226
|
+
from:
|
|
227
|
+
coalesce:
|
|
228
|
+
- "$.tweet.core.user_results.result.core.screen_name"
|
|
229
|
+
- "$.core.user_results.result.core.screen_name"
|
|
230
|
+
- "$.tweet.core.user_results.result.legacy.screen_name"
|
|
231
|
+
- "$.core.user_results.result.legacy.screen_name"
|
|
232
|
+
ops:
|
|
233
|
+
- template:
|
|
234
|
+
value: "@{{value}}"
|
|
235
|
+
- name: name
|
|
236
|
+
from:
|
|
237
|
+
coalesce:
|
|
238
|
+
- "$.tweet.core.user_results.result.core.name"
|
|
239
|
+
- "$.core.user_results.result.core.name"
|
|
240
|
+
- "$.tweet.core.user_results.result.legacy.name"
|
|
241
|
+
- "$.core.user_results.result.legacy.name"
|
|
242
|
+
- name: text
|
|
243
|
+
from:
|
|
244
|
+
coalesce:
|
|
245
|
+
- "$.tweet.legacy.full_text"
|
|
246
|
+
- "$.legacy.full_text"
|
|
247
|
+
- name: date
|
|
248
|
+
from:
|
|
249
|
+
coalesce:
|
|
250
|
+
- "$.tweet.legacy.created_at"
|
|
251
|
+
- "$.legacy.created_at"
|
|
252
|
+
transform: x_datetime
|
|
253
|
+
- name: retweets
|
|
254
|
+
from:
|
|
255
|
+
coalesce:
|
|
256
|
+
- "$.tweet.legacy.retweet_count"
|
|
257
|
+
- "$.legacy.retweet_count"
|
|
258
|
+
- name: likes
|
|
259
|
+
from:
|
|
260
|
+
coalesce:
|
|
261
|
+
- "$.tweet.legacy.favorite_count"
|
|
262
|
+
- "$.legacy.favorite_count"
|
|
263
|
+
- name: replies
|
|
264
|
+
from:
|
|
265
|
+
coalesce:
|
|
266
|
+
- "$.tweet.legacy.reply_count"
|
|
267
|
+
- "$.legacy.reply_count"
|
|
268
|
+
- name: views
|
|
269
|
+
from:
|
|
270
|
+
coalesce:
|
|
271
|
+
- "$.tweet.views.count"
|
|
272
|
+
- "$.views.count"
|
|
273
|
+
post_ops:
|
|
274
|
+
- filter_not_empty: text
|
|
275
|
+
output:
|
|
276
|
+
from_step: parsed
|
|
277
|
+
default_fields: [author, text, date, likes, retweets, views]
|
|
278
|
+
default_format: table
|
|
279
|
+
|
|
280
|
+
timeline:
|
|
281
|
+
description: "Home timeline (For you tab)"
|
|
282
|
+
args:
|
|
283
|
+
limit:
|
|
284
|
+
type: int
|
|
285
|
+
required: false
|
|
286
|
+
default: 20
|
|
287
|
+
description: "Number of tweets"
|
|
288
|
+
pipeline:
|
|
289
|
+
- request:
|
|
290
|
+
name: fetch
|
|
291
|
+
provider: x_graphql
|
|
292
|
+
operation: HomeTimeline
|
|
293
|
+
variables:
|
|
294
|
+
count: "{{args.limit}}"
|
|
295
|
+
includePromotedContent: true
|
|
296
|
+
requestContext: launch
|
|
297
|
+
withCommunity: true
|
|
298
|
+
- parse:
|
|
299
|
+
name: parsed
|
|
300
|
+
from: fetch
|
|
301
|
+
format: json
|
|
302
|
+
extract: "$.data.home.home_timeline_urt.instructions[].entries[].content.itemContent.tweet_results.result"
|
|
303
|
+
fields:
|
|
304
|
+
- name: id
|
|
305
|
+
from:
|
|
306
|
+
coalesce:
|
|
307
|
+
- "$.tweet.legacy.id_str"
|
|
308
|
+
- "$.legacy.id_str"
|
|
309
|
+
- name: author
|
|
310
|
+
from:
|
|
311
|
+
coalesce:
|
|
312
|
+
- "$.tweet.core.user_results.result.core.screen_name"
|
|
313
|
+
- "$.core.user_results.result.core.screen_name"
|
|
314
|
+
- "$.tweet.core.user_results.result.legacy.screen_name"
|
|
315
|
+
- "$.core.user_results.result.legacy.screen_name"
|
|
316
|
+
ops:
|
|
317
|
+
- template:
|
|
318
|
+
value: "@{{value}}"
|
|
319
|
+
- name: name
|
|
320
|
+
from:
|
|
321
|
+
coalesce:
|
|
322
|
+
- "$.tweet.core.user_results.result.core.name"
|
|
323
|
+
- "$.core.user_results.result.core.name"
|
|
324
|
+
- "$.tweet.core.user_results.result.legacy.name"
|
|
325
|
+
- "$.core.user_results.result.legacy.name"
|
|
326
|
+
- name: text
|
|
327
|
+
from:
|
|
328
|
+
coalesce:
|
|
329
|
+
- "$.tweet.legacy.full_text"
|
|
330
|
+
- "$.legacy.full_text"
|
|
331
|
+
- name: date
|
|
332
|
+
from:
|
|
333
|
+
coalesce:
|
|
334
|
+
- "$.tweet.legacy.created_at"
|
|
335
|
+
- "$.legacy.created_at"
|
|
336
|
+
transform: x_datetime
|
|
337
|
+
- name: retweets
|
|
338
|
+
from:
|
|
339
|
+
coalesce:
|
|
340
|
+
- "$.tweet.legacy.retweet_count"
|
|
341
|
+
- "$.legacy.retweet_count"
|
|
342
|
+
- name: likes
|
|
343
|
+
from:
|
|
344
|
+
coalesce:
|
|
345
|
+
- "$.tweet.legacy.favorite_count"
|
|
346
|
+
- "$.legacy.favorite_count"
|
|
347
|
+
- name: replies
|
|
348
|
+
from:
|
|
349
|
+
coalesce:
|
|
350
|
+
- "$.tweet.legacy.reply_count"
|
|
351
|
+
- "$.legacy.reply_count"
|
|
352
|
+
- name: views
|
|
353
|
+
from:
|
|
354
|
+
coalesce:
|
|
355
|
+
- "$.tweet.views.count"
|
|
356
|
+
- "$.views.count"
|
|
357
|
+
post_ops:
|
|
358
|
+
- filter_not_empty: text
|
|
359
|
+
output:
|
|
360
|
+
from_step: parsed
|
|
361
|
+
default_fields: [author, text, date, likes, retweets, views]
|
|
362
|
+
default_format: table
|
|
363
|
+
|
|
364
|
+
following:
|
|
365
|
+
description: "Following timeline"
|
|
366
|
+
args:
|
|
367
|
+
limit:
|
|
368
|
+
type: int
|
|
369
|
+
required: false
|
|
370
|
+
default: 20
|
|
371
|
+
description: "Number of tweets"
|
|
372
|
+
sort:
|
|
373
|
+
type: string
|
|
374
|
+
required: false
|
|
375
|
+
default: recent
|
|
376
|
+
description: "Sort order: recent or popular"
|
|
377
|
+
pipeline:
|
|
378
|
+
- request:
|
|
379
|
+
name: fetch
|
|
380
|
+
provider: x_graphql
|
|
381
|
+
operation: HomeLatestTimeline
|
|
382
|
+
variables:
|
|
383
|
+
count: "{{args.limit}}"
|
|
384
|
+
includePromotedContent: true
|
|
385
|
+
- parse:
|
|
386
|
+
name: parsed
|
|
387
|
+
from: fetch
|
|
388
|
+
format: json
|
|
389
|
+
extract: "$.data.home.home_timeline_urt.instructions[].entries[].content.itemContent.tweet_results.result"
|
|
390
|
+
fields:
|
|
391
|
+
- name: id
|
|
392
|
+
from:
|
|
393
|
+
coalesce:
|
|
394
|
+
- "$.tweet.legacy.id_str"
|
|
395
|
+
- "$.legacy.id_str"
|
|
396
|
+
- name: author
|
|
397
|
+
from:
|
|
398
|
+
coalesce:
|
|
399
|
+
- "$.tweet.core.user_results.result.core.screen_name"
|
|
400
|
+
- "$.core.user_results.result.core.screen_name"
|
|
401
|
+
- "$.tweet.core.user_results.result.legacy.screen_name"
|
|
402
|
+
- "$.core.user_results.result.legacy.screen_name"
|
|
403
|
+
ops:
|
|
404
|
+
- template:
|
|
405
|
+
value: "@{{value}}"
|
|
406
|
+
- name: name
|
|
407
|
+
from:
|
|
408
|
+
coalesce:
|
|
409
|
+
- "$.tweet.core.user_results.result.core.name"
|
|
410
|
+
- "$.core.user_results.result.core.name"
|
|
411
|
+
- "$.tweet.core.user_results.result.legacy.name"
|
|
412
|
+
- "$.core.user_results.result.legacy.name"
|
|
413
|
+
- name: text
|
|
414
|
+
from:
|
|
415
|
+
coalesce:
|
|
416
|
+
- "$.tweet.legacy.full_text"
|
|
417
|
+
- "$.legacy.full_text"
|
|
418
|
+
- name: date
|
|
419
|
+
from:
|
|
420
|
+
coalesce:
|
|
421
|
+
- "$.tweet.legacy.created_at"
|
|
422
|
+
- "$.legacy.created_at"
|
|
423
|
+
transform: x_datetime
|
|
424
|
+
- name: retweets
|
|
425
|
+
from:
|
|
426
|
+
coalesce:
|
|
427
|
+
- "$.tweet.legacy.retweet_count"
|
|
428
|
+
- "$.legacy.retweet_count"
|
|
429
|
+
- name: likes
|
|
430
|
+
from:
|
|
431
|
+
coalesce:
|
|
432
|
+
- "$.tweet.legacy.favorite_count"
|
|
433
|
+
- "$.legacy.favorite_count"
|
|
434
|
+
- name: replies
|
|
435
|
+
from:
|
|
436
|
+
coalesce:
|
|
437
|
+
- "$.tweet.legacy.reply_count"
|
|
438
|
+
- "$.legacy.reply_count"
|
|
439
|
+
- name: views
|
|
440
|
+
from:
|
|
441
|
+
coalesce:
|
|
442
|
+
- "$.tweet.views.count"
|
|
443
|
+
- "$.views.count"
|
|
444
|
+
post_ops:
|
|
445
|
+
- filter_not_empty: text
|
|
446
|
+
output:
|
|
447
|
+
from_step: parsed
|
|
448
|
+
default_fields: [author, text, date, likes, retweets, views]
|
|
449
|
+
default_format: table
|
web2cli/auth/__init__.py
ADDED
|
File without changes
|