getanyapi 0.1.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.
Files changed (68) hide show
  1. getanyapi/__init__.py +76 -0
  2. getanyapi/_account.py +132 -0
  3. getanyapi/_async_client.py +215 -0
  4. getanyapi/_client.py +274 -0
  5. getanyapi/_errors.py +115 -0
  6. getanyapi/_pagination.py +295 -0
  7. getanyapi/_transport.py +239 -0
  8. getanyapi/platforms/__init__.py +89 -0
  9. getanyapi/platforms/ahrefs.py +384 -0
  10. getanyapi/platforms/airbnb.py +120 -0
  11. getanyapi/platforms/alibaba.py +95 -0
  12. getanyapi/platforms/amazon.py +442 -0
  13. getanyapi/platforms/appstore.py +95 -0
  14. getanyapi/platforms/bluesky.py +215 -0
  15. getanyapi/platforms/booking.py +128 -0
  16. getanyapi/platforms/coinmarketcap.py +113 -0
  17. getanyapi/platforms/congress.py +106 -0
  18. getanyapi/platforms/dexscreener.py +104 -0
  19. getanyapi/platforms/ebay.py +215 -0
  20. getanyapi/platforms/email.py +166 -0
  21. getanyapi/platforms/facebook.py +2324 -0
  22. getanyapi/platforms/fiverr.py +122 -0
  23. getanyapi/platforms/github.py +954 -0
  24. getanyapi/platforms/glassdoor.py +93 -0
  25. getanyapi/platforms/google.py +232 -0
  26. getanyapi/platforms/google_ads.py +380 -0
  27. getanyapi/platforms/google_finance.py +170 -0
  28. getanyapi/platforms/google_shopping.py +103 -0
  29. getanyapi/platforms/hackernews.py +276 -0
  30. getanyapi/platforms/indeed.py +114 -0
  31. getanyapi/platforms/instagram.py +1868 -0
  32. getanyapi/platforms/linkedin.py +1064 -0
  33. getanyapi/platforms/maps.py +412 -0
  34. getanyapi/platforms/pandaexpress.py +262 -0
  35. getanyapi/platforms/person.py +96 -0
  36. getanyapi/platforms/pinterest.py +96 -0
  37. getanyapi/platforms/playstore.py +99 -0
  38. getanyapi/platforms/polymarket.py +109 -0
  39. getanyapi/platforms/realtor.py +104 -0
  40. getanyapi/platforms/reddit.py +582 -0
  41. getanyapi/platforms/redfin.py +95 -0
  42. getanyapi/platforms/rednote.py +807 -0
  43. getanyapi/platforms/sec.py +118 -0
  44. getanyapi/platforms/semrush.py +358 -0
  45. getanyapi/platforms/snapchat.py +146 -0
  46. getanyapi/platforms/social.py +105 -0
  47. getanyapi/platforms/spotify.py +588 -0
  48. getanyapi/platforms/substack.py +142 -0
  49. getanyapi/platforms/threads.py +358 -0
  50. getanyapi/platforms/tiktok.py +1827 -0
  51. getanyapi/platforms/tiktok_shop.py +536 -0
  52. getanyapi/platforms/tripadvisor.py +180 -0
  53. getanyapi/platforms/trustpilot.py +114 -0
  54. getanyapi/platforms/truthsocial.py +226 -0
  55. getanyapi/platforms/twitter.py +798 -0
  56. getanyapi/platforms/upwork.py +119 -0
  57. getanyapi/platforms/walmart.py +93 -0
  58. getanyapi/platforms/web.py +264 -0
  59. getanyapi/platforms/whatsapp.py +91 -0
  60. getanyapi/platforms/yahoo_finance.py +95 -0
  61. getanyapi/platforms/yelp.py +141 -0
  62. getanyapi/platforms/youtube.py +1452 -0
  63. getanyapi/platforms/zillow.py +218 -0
  64. getanyapi/py.typed +0 -0
  65. getanyapi/types.py +170 -0
  66. getanyapi-0.1.0.dist-info/METADATA +155 -0
  67. getanyapi-0.1.0.dist-info/RECORD +68 -0
  68. getanyapi-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,798 @@
1
+ # Generated - do not edit. Regenerate with: pnpm generate
2
+ """Generated namespace module for the twitter platform."""
3
+
4
+ from __future__ import annotations
5
+
6
+ from typing import TYPE_CHECKING
7
+
8
+ from pydantic import BaseModel, ConfigDict, Field
9
+ from typing_extensions import NotRequired, Required, TypedDict, Unpack
10
+
11
+ from ..types import RequestOptions, RunResult
12
+ from .._pagination import (
13
+ AsyncPaginator,
14
+ Paginator,
15
+ apaginate,
16
+ paginate,
17
+ )
18
+
19
+ if TYPE_CHECKING:
20
+ from .._async_client import AsyncAnyAPI
21
+ from .._client import AnyAPI
22
+
23
+
24
+ class TwitterCommunityInput(TypedDict, total=False):
25
+ """Input for Twitter Community."""
26
+
27
+ url: Required[str]
28
+ """Community URL (e.g. https://x.com/i/communities/1926186499399139650)."""
29
+
30
+
31
+ class TwitterCommunityTweetsInput(TypedDict, total=False):
32
+ """Input for Twitter Community Tweets."""
33
+
34
+ url: Required[str]
35
+ """Community URL (e.g. https://x.com/i/communities/1926186499399139650)."""
36
+
37
+
38
+ class TwitterFollowersInput(TypedDict, total=False):
39
+ """Input for X / Twitter Followers."""
40
+
41
+ limit: NotRequired[int]
42
+ """Maximum number of results to return (1-100000, default 200). You are billed per result returned, so a lower limit costs less. Range: 1 to 100000. Default: 200."""
43
+ username: Required[str]
44
+ """The X (Twitter) username to fetch followers for, without the @ prefix (e.g. elonmusk)."""
45
+
46
+
47
+ class TwitterFollowingInput(TypedDict, total=False):
48
+ """Input for X / Twitter Following."""
49
+
50
+ limit: NotRequired[int]
51
+ """Maximum number of results to return (1-100000, default 200). You are billed per result returned, so a lower limit costs less. Range: 1 to 100000. Default: 200."""
52
+ username: Required[str]
53
+ """The X (Twitter) username to fetch the following list for, without the @ prefix (e.g. elonmusk)."""
54
+
55
+
56
+ class TwitterProfileInput(TypedDict, total=False):
57
+ """Input for Twitter Profile."""
58
+
59
+ handle: Required[str]
60
+ """Twitter/X handle without the leading @."""
61
+
62
+
63
+ class TwitterRepliesInput(TypedDict, total=False):
64
+ """Input for X / Twitter Post Replies."""
65
+
66
+ limit: NotRequired[int]
67
+ """Maximum number of results to return (1-40, default 40). You are billed per result returned, so a lower limit costs less. Range: 1 to 40."""
68
+ url: Required[str]
69
+ """Full URL of the X (Twitter) post to fetch replies for (e.g. https://x.com/nasa/status/1846987139428634858)."""
70
+
71
+
72
+ class TwitterSearchInput(TypedDict, total=False):
73
+ """Input for X / Twitter Search."""
74
+
75
+ lang: NotRequired[str]
76
+ """Optional ISO 639-1 language code to restrict tweets to (e.g. en)."""
77
+ limit: NotRequired[int]
78
+ """Maximum number of results to return (1-50, default 50). You are billed per result returned, so a lower limit costs less. Range: 1 to 50."""
79
+ query: Required[str]
80
+ """Search query using X advanced-search syntax. IMPORTANT: terms are ANDed - a tweet must contain EVERY word, so a list of loosely related keywords matches nothing. Use one short phrase, or OR between alternatives (e.g. 'anyapi OR getanyapi'). Useful operators: from:user, since:YYYY-MM-DD, "exact phrase", -filter:replies. A query with no matches returns an empty items array; prefer the fewest words that identify the topic."""
81
+ queryType: NotRequired[str]
82
+ """Result ranking: 'Latest', 'Top', 'Photos', or 'Videos' (e.g. Latest). Default: Latest."""
83
+
84
+
85
+ class TwitterTweetInput(TypedDict, total=False):
86
+ """Input for Twitter Tweet."""
87
+
88
+ url: Required[str]
89
+ """Full tweet URL, e.g. https://x.com/NASA/status/1800000000000000000."""
90
+
91
+
92
+ class TwitterTweetTranscriptInput(TypedDict, total=False):
93
+ """Input for Twitter Tweet Transcript."""
94
+
95
+ url: Required[str]
96
+ """Tweet URL of the video to transcribe (e.g. https://x.com/TheoVon/status/1916982720317821050)."""
97
+
98
+
99
+ class TwitterUserTweetsInput(TypedDict, total=False):
100
+ """Input for Twitter User Tweets."""
101
+
102
+ cursor: NotRequired[str]
103
+ """Opaque pagination cursor from a previous response's nextCursor. Omit for the first page; pass it to fetch the next page of tweets."""
104
+ handle: Required[str]
105
+ """Twitter/X handle without the leading @."""
106
+ limit: NotRequired[int]
107
+ """How many tweets you want (1-1000), newest first. By default results may come back in cheap pages of ~20: follow the response's nextCursor for more. With requireSinglePage true, up to this many are returned in one (pricier) call. Range: 1 to 1000. Default: 20."""
108
+ requireSinglePage: NotRequired[bool]
109
+ """Set true to get up to limit tweets in a single response instead of cheap pages, served by a bulk provider at a higher price."""
110
+
111
+
112
+ class TwitterCommunityData(BaseModel):
113
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
114
+
115
+ created_at: float = Field(alias="createdAt")
116
+ creator_handle: str = Field(alias="creatorHandle")
117
+ description: str
118
+ id: str
119
+ join_policy: str = Field(alias="joinPolicy")
120
+ member_count: int = Field(alias="memberCount")
121
+ name: str
122
+
123
+
124
+ class TwitterCommunityTweetsData(BaseModel):
125
+ tweets: list[TwitterCommunityTweetsTweet]
126
+
127
+
128
+ class TwitterCommunityTweetsTweet(BaseModel):
129
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
130
+
131
+ author_handle: str = Field(alias="authorHandle")
132
+ created_at: str = Field(alias="createdAt")
133
+ favorite_count: int = Field(alias="favoriteCount")
134
+ id: str
135
+ quote_count: int = Field(alias="quoteCount")
136
+ reply_count: int = Field(alias="replyCount")
137
+ retweet_count: int = Field(alias="retweetCount")
138
+ text: str
139
+
140
+
141
+ class TwitterFollowersData(BaseModel):
142
+ items: list[TwitterFollowersItem] = Field(
143
+ description="Follower records, normalized to a compact shape."
144
+ )
145
+
146
+
147
+ class TwitterFollowersItem(BaseModel):
148
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
149
+
150
+ avatar_url: str = Field(
151
+ alias="avatarUrl",
152
+ description="URL of the account's profile image (may be empty).",
153
+ )
154
+ bio: str = Field(description="The account's profile bio/description.")
155
+ followers: int = Field(description="How many followers this account has.")
156
+ following: int = Field(description="How many accounts this account follows.")
157
+ location: str = Field(
158
+ description="The account's self-reported location (may be empty)."
159
+ )
160
+ name: str = Field(description="The account's display name.")
161
+ username: str = Field(description="The account's @ handle, without the @ prefix.")
162
+ verified: bool = Field(description="Whether the account is verified.")
163
+
164
+
165
+ class TwitterFollowingData(BaseModel):
166
+ items: list[TwitterFollowingItem] = Field(
167
+ description="Followed-account records, normalized to a compact shape."
168
+ )
169
+
170
+
171
+ class TwitterFollowingItem(BaseModel):
172
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
173
+
174
+ avatar_url: str = Field(
175
+ alias="avatarUrl",
176
+ description="URL of the account's profile image (may be empty).",
177
+ )
178
+ bio: str = Field(description="The account's profile bio/description.")
179
+ followers: int = Field(description="How many followers this account has.")
180
+ following: int = Field(description="How many accounts this account follows.")
181
+ location: str = Field(
182
+ description="The account's self-reported location (may be empty)."
183
+ )
184
+ name: str = Field(description="The account's display name.")
185
+ username: str = Field(description="The account's @ handle, without the @ prefix.")
186
+ verified: bool = Field(description="Whether the account is verified.")
187
+
188
+
189
+ class TwitterProfileData(BaseModel):
190
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
191
+
192
+ avatar_url: str = Field(alias="avatarUrl")
193
+ bio: str
194
+ display_name: str = Field(alias="displayName")
195
+ followers: int
196
+ following: int
197
+ handle: str
198
+ tweets: int
199
+ verified: bool
200
+
201
+
202
+ class TwitterRepliesData(BaseModel):
203
+ items: list[TwitterRepliesItem] = Field(
204
+ description="Reply records: reply text, author profile, timestamp, and engagement metrics."
205
+ )
206
+
207
+
208
+ class TwitterRepliesItem(BaseModel):
209
+ model_config = ConfigDict(extra="allow")
210
+
211
+ id: str | None = Field(
212
+ default=None, description="Present whenever the upstream returns this record."
213
+ )
214
+ text: str
215
+ url: str
216
+
217
+
218
+ class TwitterSearchData(BaseModel):
219
+ items: list[TwitterSearchItem] = Field(
220
+ description="Tweet records: text, author profile, timestamp, and engagement metrics (likes, retweets, replies, views)."
221
+ )
222
+
223
+
224
+ class TwitterSearchItem(BaseModel):
225
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
226
+
227
+ author_name: str | None = Field(
228
+ default=None,
229
+ alias="authorName",
230
+ description="Present whenever the upstream returns this record.",
231
+ )
232
+ author_username: str | None = Field(
233
+ default=None,
234
+ alias="authorUsername",
235
+ description="Present whenever the upstream returns this record.",
236
+ )
237
+ author_verified: bool | None = Field(default=None, alias="authorVerified")
238
+ bookmark_count: int | None = Field(default=None, alias="bookmarkCount")
239
+ conversation_id: str | None = Field(default=None, alias="conversationId")
240
+ created_at: str | None = Field(
241
+ default=None,
242
+ alias="createdAt",
243
+ description="Tweet creation time. Present whenever the upstream returns this record.",
244
+ )
245
+ id: str
246
+ is_reply: bool | None = Field(default=None, alias="isReply")
247
+ lang: str | None = None
248
+ like_count: int | None = Field(default=None, alias="likeCount")
249
+ quote_count: int | None = Field(default=None, alias="quoteCount")
250
+ reply_count: int | None = Field(default=None, alias="replyCount")
251
+ retweet_count: int | None = Field(default=None, alias="retweetCount")
252
+ text: str
253
+ url: str
254
+ view_count: int | None = Field(default=None, alias="viewCount")
255
+
256
+
257
+ class TwitterTweetData(BaseModel):
258
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
259
+
260
+ author_id: str = Field(alias="authorId")
261
+ bookmarks: int
262
+ created_at: str = Field(alias="createdAt")
263
+ id: str
264
+ likes: int
265
+ quotes: int
266
+ replies: int
267
+ retweets: int
268
+ text: str
269
+ views: int
270
+
271
+
272
+ class TwitterTweetTranscriptData(BaseModel):
273
+ model_config = ConfigDict(extra="allow")
274
+
275
+ transcript: str
276
+
277
+
278
+ class TwitterUserTweetsData(BaseModel):
279
+ model_config = ConfigDict(populate_by_name=True)
280
+
281
+ next_cursor: str | None = Field(
282
+ default=None,
283
+ alias="nextCursor",
284
+ description="Opaque cursor for the next page of tweets, or null when this lane has no more. Pass it back as cursor to continue.",
285
+ )
286
+ tweets: list[TwitterUserTweetsTweet]
287
+
288
+
289
+ class TwitterUserTweetsTweet(BaseModel):
290
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
291
+
292
+ bookmarks: int
293
+ created_at: str = Field(alias="createdAt")
294
+ id: str
295
+ is_pinned: bool = Field(alias="isPinned")
296
+ is_reply: bool | None = Field(default=None, alias="isReply")
297
+ lang: str | None = None
298
+ likes: int
299
+ quotes: int | None = None
300
+ replies: int
301
+ retweets: int
302
+ text: str
303
+ url: str
304
+ views: int
305
+
306
+
307
+ class TwitterNamespace:
308
+ """Typed methods for this platform. Attached lazily to the client."""
309
+
310
+ def __init__(self, client: "AnyAPI") -> None:
311
+ self._client = client
312
+
313
+ def community(
314
+ self,
315
+ *,
316
+ options: RequestOptions | None = None,
317
+ **input: Unpack[TwitterCommunityInput],
318
+ ) -> RunResult[TwitterCommunityData]:
319
+ """Twitter Community
320
+
321
+ Fetch a Twitter/X community's public details (name, description, member
322
+ count, join policy) by URL, normalized across providers with transparent
323
+ failover.
324
+
325
+ Price: $0.002 per request.
326
+
327
+ Example:
328
+ res = client.twitter.community(url="https://x.com/i/communities/1926186499399139650")
329
+ """
330
+ raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
331
+ "twitter.community", dict(input), options
332
+ )
333
+ return RunResult[TwitterCommunityData].model_validate(raw)
334
+
335
+ def community_tweets(
336
+ self,
337
+ *,
338
+ options: RequestOptions | None = None,
339
+ **input: Unpack[TwitterCommunityTweetsInput],
340
+ ) -> RunResult[TwitterCommunityTweetsData]:
341
+ """Twitter Community Tweets
342
+
343
+ List recent tweets posted in a Twitter/X community by URL, normalized across
344
+ providers with transparent failover.
345
+
346
+ Price: $0.002 per request.
347
+
348
+ Example:
349
+ res = client.twitter.community_tweets(url="https://x.com/i/communities/1926186499399139650")
350
+ """
351
+ raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
352
+ "twitter.community_tweets", dict(input), options
353
+ )
354
+ return RunResult[TwitterCommunityTweetsData].model_validate(raw)
355
+
356
+ def followers(
357
+ self,
358
+ *,
359
+ options: RequestOptions | None = None,
360
+ **input: Unpack[TwitterFollowersInput],
361
+ ) -> RunResult[TwitterFollowersData]:
362
+ """X / Twitter Followers
363
+
364
+ Fetch the follower list of any public X (Twitter) account by username - up
365
+ to 100,000 follower records per request with transparent per-result USD
366
+ pricing.
367
+
368
+ Price: $0.00015 per result.
369
+
370
+ Example:
371
+ res = client.twitter.followers(limit=200, username="nasa")
372
+ """
373
+ raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
374
+ "twitter.followers", dict(input), options
375
+ )
376
+ return RunResult[TwitterFollowersData].model_validate(raw)
377
+
378
+ def following(
379
+ self,
380
+ *,
381
+ options: RequestOptions | None = None,
382
+ **input: Unpack[TwitterFollowingInput],
383
+ ) -> RunResult[TwitterFollowingData]:
384
+ """X / Twitter Following
385
+
386
+ List the accounts a public X (Twitter) account follows by username - up to
387
+ 100,000 records per request with transparent per-result USD pricing.
388
+
389
+ Price: $0.00015 per result.
390
+
391
+ Example:
392
+ res = client.twitter.following(limit=200, username="nasa")
393
+ """
394
+ raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
395
+ "twitter.following", dict(input), options
396
+ )
397
+ return RunResult[TwitterFollowingData].model_validate(raw)
398
+
399
+ def profile(
400
+ self,
401
+ *,
402
+ options: RequestOptions | None = None,
403
+ **input: Unpack[TwitterProfileInput],
404
+ ) -> RunResult[TwitterProfileData]:
405
+ """Twitter Profile
406
+
407
+ Fetch a Twitter/X account's public profile (followers, tweets, bio,
408
+ verification) by handle, normalized across providers with transparent
409
+ failover.
410
+
411
+ Price: $0.001 per request.
412
+
413
+ Example:
414
+ res = client.twitter.profile(handle="nasa")
415
+ """
416
+ raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
417
+ "twitter.profile", dict(input), options
418
+ )
419
+ return RunResult[TwitterProfileData].model_validate(raw)
420
+
421
+ def replies(
422
+ self,
423
+ *,
424
+ options: RequestOptions | None = None,
425
+ **input: Unpack[TwitterRepliesInput],
426
+ ) -> RunResult[TwitterRepliesData]:
427
+ """X / Twitter Post Replies
428
+
429
+ Fetch the replies to any X (Twitter) post URL as structured records -
430
+ author, text, and engagement - priced per request in USD.
431
+
432
+ Price: $0.0025 per request plus $0.00025 per result.
433
+
434
+ Example:
435
+ res = client.twitter.replies(limit=3, url="https://x.com/jack/status/20")
436
+ """
437
+ raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
438
+ "twitter.replies", dict(input), options
439
+ )
440
+ return RunResult[TwitterRepliesData].model_validate(raw)
441
+
442
+ def search(
443
+ self,
444
+ *,
445
+ options: RequestOptions | None = None,
446
+ **input: Unpack[TwitterSearchInput],
447
+ ) -> RunResult[TwitterSearchData]:
448
+ """X / Twitter Search
449
+
450
+ Search X (Twitter) with full advanced-search syntax and get up to 50
451
+ structured tweets per request - text, author, and engagement - with
452
+ transparent per-request USD pricing.
453
+
454
+ Price: $0.004 per request plus $0.0002 per result.
455
+
456
+ Example:
457
+ res = client.twitter.search(query="openai")
458
+ """
459
+ raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
460
+ "twitter.search", dict(input), options
461
+ )
462
+ return RunResult[TwitterSearchData].model_validate(raw)
463
+
464
+ def tweet(
465
+ self,
466
+ *,
467
+ options: RequestOptions | None = None,
468
+ **input: Unpack[TwitterTweetInput],
469
+ ) -> RunResult[TwitterTweetData]:
470
+ """Twitter Tweet
471
+
472
+ Fetch a single Twitter/X tweet by URL with its full text and engagement
473
+ counts (likes, retweets, replies, quotes, bookmarks, views), normalized
474
+ across providers.
475
+
476
+ Price: $0.002 per request.
477
+
478
+ Example:
479
+ res = client.twitter.tweet(url="https://x.com/SpaceX/status/1732824684683784516")
480
+ """
481
+ raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
482
+ "twitter.tweet", dict(input), options
483
+ )
484
+ return RunResult[TwitterTweetData].model_validate(raw)
485
+
486
+ def tweet_transcript(
487
+ self,
488
+ *,
489
+ options: RequestOptions | None = None,
490
+ **input: Unpack[TwitterTweetTranscriptInput],
491
+ ) -> RunResult[TwitterTweetTranscriptData]:
492
+ """Twitter Tweet Transcript
493
+
494
+ Extract the spoken transcript from a Twitter/X video tweet by URL,
495
+ normalized across providers with transparent failover.
496
+
497
+ Price: $0.002 per request.
498
+
499
+ Example:
500
+ res = client.twitter.tweet_transcript(url="https://x.com/TheoVon/status/1916982720317821050")
501
+ """
502
+ raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
503
+ "twitter.tweet_transcript", dict(input), options
504
+ )
505
+ return RunResult[TwitterTweetTranscriptData].model_validate(raw)
506
+
507
+ def user_tweets(
508
+ self,
509
+ *,
510
+ options: RequestOptions | None = None,
511
+ **input: Unpack[TwitterUserTweetsInput],
512
+ ) -> RunResult[TwitterUserTweetsData]:
513
+ """Twitter User Tweets
514
+
515
+ Get an X (Twitter) account's latest tweets by handle, newest first
516
+ (reverse-chronological, replies included) - not just the popular ones - up
517
+ to 1000 per call, with engagement, views, and language, normalized across
518
+ providers with cursor pagination.
519
+
520
+ Price: $0.001 per request.
521
+
522
+ Example:
523
+ res = client.twitter.user_tweets(handle="levelsio", limit=20)
524
+ """
525
+ raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
526
+ "twitter.user_tweets", dict(input), options
527
+ )
528
+ return RunResult[TwitterUserTweetsData].model_validate(raw)
529
+
530
+ def iter_user_tweets(
531
+ self,
532
+ *,
533
+ options: RequestOptions | None = None,
534
+ **input: Unpack[TwitterUserTweetsInput],
535
+ ) -> Paginator[TwitterUserTweetsTweet, TwitterUserTweetsData]:
536
+ """Iterate Twitter User Tweets results, following pagination cursors.
537
+
538
+ Yields validated `TwitterUserTweetsTweet` items from the `tweets` field of
539
+ each page. Use `.pages()` on the returned paginator to walk whole
540
+ `RunResult` pages.
541
+ """
542
+ return paginate(
543
+ self._client,
544
+ "twitter.user_tweets",
545
+ dict(input),
546
+ "tweets",
547
+ item_model=TwitterUserTweetsTweet,
548
+ data_model=TwitterUserTweetsData,
549
+ bare=False,
550
+ options=options,
551
+ )
552
+
553
+
554
+ class AsyncTwitterNamespace:
555
+ """Typed methods for this platform. Attached lazily to the client."""
556
+
557
+ def __init__(self, client: "AsyncAnyAPI") -> None:
558
+ self._client = client
559
+
560
+ async def community(
561
+ self,
562
+ *,
563
+ options: RequestOptions | None = None,
564
+ **input: Unpack[TwitterCommunityInput],
565
+ ) -> RunResult[TwitterCommunityData]:
566
+ """Twitter Community
567
+
568
+ Fetch a Twitter/X community's public details (name, description, member
569
+ count, join policy) by URL, normalized across providers with transparent
570
+ failover.
571
+
572
+ Price: $0.002 per request.
573
+
574
+ Example:
575
+ res = client.twitter.community(url="https://x.com/i/communities/1926186499399139650")
576
+ """
577
+ raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
578
+ "twitter.community", dict(input), options
579
+ )
580
+ return RunResult[TwitterCommunityData].model_validate(raw)
581
+
582
+ async def community_tweets(
583
+ self,
584
+ *,
585
+ options: RequestOptions | None = None,
586
+ **input: Unpack[TwitterCommunityTweetsInput],
587
+ ) -> RunResult[TwitterCommunityTweetsData]:
588
+ """Twitter Community Tweets
589
+
590
+ List recent tweets posted in a Twitter/X community by URL, normalized across
591
+ providers with transparent failover.
592
+
593
+ Price: $0.002 per request.
594
+
595
+ Example:
596
+ res = client.twitter.community_tweets(url="https://x.com/i/communities/1926186499399139650")
597
+ """
598
+ raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
599
+ "twitter.community_tweets", dict(input), options
600
+ )
601
+ return RunResult[TwitterCommunityTweetsData].model_validate(raw)
602
+
603
+ async def followers(
604
+ self,
605
+ *,
606
+ options: RequestOptions | None = None,
607
+ **input: Unpack[TwitterFollowersInput],
608
+ ) -> RunResult[TwitterFollowersData]:
609
+ """X / Twitter Followers
610
+
611
+ Fetch the follower list of any public X (Twitter) account by username - up
612
+ to 100,000 follower records per request with transparent per-result USD
613
+ pricing.
614
+
615
+ Price: $0.00015 per result.
616
+
617
+ Example:
618
+ res = client.twitter.followers(limit=200, username="nasa")
619
+ """
620
+ raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
621
+ "twitter.followers", dict(input), options
622
+ )
623
+ return RunResult[TwitterFollowersData].model_validate(raw)
624
+
625
+ async def following(
626
+ self,
627
+ *,
628
+ options: RequestOptions | None = None,
629
+ **input: Unpack[TwitterFollowingInput],
630
+ ) -> RunResult[TwitterFollowingData]:
631
+ """X / Twitter Following
632
+
633
+ List the accounts a public X (Twitter) account follows by username - up to
634
+ 100,000 records per request with transparent per-result USD pricing.
635
+
636
+ Price: $0.00015 per result.
637
+
638
+ Example:
639
+ res = client.twitter.following(limit=200, username="nasa")
640
+ """
641
+ raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
642
+ "twitter.following", dict(input), options
643
+ )
644
+ return RunResult[TwitterFollowingData].model_validate(raw)
645
+
646
+ async def profile(
647
+ self,
648
+ *,
649
+ options: RequestOptions | None = None,
650
+ **input: Unpack[TwitterProfileInput],
651
+ ) -> RunResult[TwitterProfileData]:
652
+ """Twitter Profile
653
+
654
+ Fetch a Twitter/X account's public profile (followers, tweets, bio,
655
+ verification) by handle, normalized across providers with transparent
656
+ failover.
657
+
658
+ Price: $0.001 per request.
659
+
660
+ Example:
661
+ res = client.twitter.profile(handle="nasa")
662
+ """
663
+ raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
664
+ "twitter.profile", dict(input), options
665
+ )
666
+ return RunResult[TwitterProfileData].model_validate(raw)
667
+
668
+ async def replies(
669
+ self,
670
+ *,
671
+ options: RequestOptions | None = None,
672
+ **input: Unpack[TwitterRepliesInput],
673
+ ) -> RunResult[TwitterRepliesData]:
674
+ """X / Twitter Post Replies
675
+
676
+ Fetch the replies to any X (Twitter) post URL as structured records -
677
+ author, text, and engagement - priced per request in USD.
678
+
679
+ Price: $0.0025 per request plus $0.00025 per result.
680
+
681
+ Example:
682
+ res = client.twitter.replies(limit=3, url="https://x.com/jack/status/20")
683
+ """
684
+ raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
685
+ "twitter.replies", dict(input), options
686
+ )
687
+ return RunResult[TwitterRepliesData].model_validate(raw)
688
+
689
+ async def search(
690
+ self,
691
+ *,
692
+ options: RequestOptions | None = None,
693
+ **input: Unpack[TwitterSearchInput],
694
+ ) -> RunResult[TwitterSearchData]:
695
+ """X / Twitter Search
696
+
697
+ Search X (Twitter) with full advanced-search syntax and get up to 50
698
+ structured tweets per request - text, author, and engagement - with
699
+ transparent per-request USD pricing.
700
+
701
+ Price: $0.004 per request plus $0.0002 per result.
702
+
703
+ Example:
704
+ res = client.twitter.search(query="openai")
705
+ """
706
+ raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
707
+ "twitter.search", dict(input), options
708
+ )
709
+ return RunResult[TwitterSearchData].model_validate(raw)
710
+
711
+ async def tweet(
712
+ self,
713
+ *,
714
+ options: RequestOptions | None = None,
715
+ **input: Unpack[TwitterTweetInput],
716
+ ) -> RunResult[TwitterTweetData]:
717
+ """Twitter Tweet
718
+
719
+ Fetch a single Twitter/X tweet by URL with its full text and engagement
720
+ counts (likes, retweets, replies, quotes, bookmarks, views), normalized
721
+ across providers.
722
+
723
+ Price: $0.002 per request.
724
+
725
+ Example:
726
+ res = client.twitter.tweet(url="https://x.com/SpaceX/status/1732824684683784516")
727
+ """
728
+ raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
729
+ "twitter.tweet", dict(input), options
730
+ )
731
+ return RunResult[TwitterTweetData].model_validate(raw)
732
+
733
+ async def tweet_transcript(
734
+ self,
735
+ *,
736
+ options: RequestOptions | None = None,
737
+ **input: Unpack[TwitterTweetTranscriptInput],
738
+ ) -> RunResult[TwitterTweetTranscriptData]:
739
+ """Twitter Tweet Transcript
740
+
741
+ Extract the spoken transcript from a Twitter/X video tweet by URL,
742
+ normalized across providers with transparent failover.
743
+
744
+ Price: $0.002 per request.
745
+
746
+ Example:
747
+ res = client.twitter.tweet_transcript(url="https://x.com/TheoVon/status/1916982720317821050")
748
+ """
749
+ raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
750
+ "twitter.tweet_transcript", dict(input), options
751
+ )
752
+ return RunResult[TwitterTweetTranscriptData].model_validate(raw)
753
+
754
+ async def user_tweets(
755
+ self,
756
+ *,
757
+ options: RequestOptions | None = None,
758
+ **input: Unpack[TwitterUserTweetsInput],
759
+ ) -> RunResult[TwitterUserTweetsData]:
760
+ """Twitter User Tweets
761
+
762
+ Get an X (Twitter) account's latest tweets by handle, newest first
763
+ (reverse-chronological, replies included) - not just the popular ones - up
764
+ to 1000 per call, with engagement, views, and language, normalized across
765
+ providers with cursor pagination.
766
+
767
+ Price: $0.001 per request.
768
+
769
+ Example:
770
+ res = client.twitter.user_tweets(handle="levelsio", limit=20)
771
+ """
772
+ raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
773
+ "twitter.user_tweets", dict(input), options
774
+ )
775
+ return RunResult[TwitterUserTweetsData].model_validate(raw)
776
+
777
+ def iter_user_tweets(
778
+ self,
779
+ *,
780
+ options: RequestOptions | None = None,
781
+ **input: Unpack[TwitterUserTweetsInput],
782
+ ) -> AsyncPaginator[TwitterUserTweetsTweet, TwitterUserTweetsData]:
783
+ """Iterate Twitter User Tweets results, following pagination cursors.
784
+
785
+ Yields validated `TwitterUserTweetsTweet` items from the `tweets` field of
786
+ each page. Use `.pages()` on the returned paginator to walk whole
787
+ `RunResult` pages.
788
+ """
789
+ return apaginate(
790
+ self._client,
791
+ "twitter.user_tweets",
792
+ dict(input),
793
+ "tweets",
794
+ item_model=TwitterUserTweetsTweet,
795
+ data_model=TwitterUserTweetsData,
796
+ bare=False,
797
+ options=options,
798
+ )