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.
- getanyapi/__init__.py +76 -0
- getanyapi/_account.py +132 -0
- getanyapi/_async_client.py +215 -0
- getanyapi/_client.py +274 -0
- getanyapi/_errors.py +115 -0
- getanyapi/_pagination.py +295 -0
- getanyapi/_transport.py +239 -0
- getanyapi/platforms/__init__.py +89 -0
- getanyapi/platforms/ahrefs.py +384 -0
- getanyapi/platforms/airbnb.py +120 -0
- getanyapi/platforms/alibaba.py +95 -0
- getanyapi/platforms/amazon.py +442 -0
- getanyapi/platforms/appstore.py +95 -0
- getanyapi/platforms/bluesky.py +215 -0
- getanyapi/platforms/booking.py +128 -0
- getanyapi/platforms/coinmarketcap.py +113 -0
- getanyapi/platforms/congress.py +106 -0
- getanyapi/platforms/dexscreener.py +104 -0
- getanyapi/platforms/ebay.py +215 -0
- getanyapi/platforms/email.py +166 -0
- getanyapi/platforms/facebook.py +2324 -0
- getanyapi/platforms/fiverr.py +122 -0
- getanyapi/platforms/github.py +954 -0
- getanyapi/platforms/glassdoor.py +93 -0
- getanyapi/platforms/google.py +232 -0
- getanyapi/platforms/google_ads.py +380 -0
- getanyapi/platforms/google_finance.py +170 -0
- getanyapi/platforms/google_shopping.py +103 -0
- getanyapi/platforms/hackernews.py +276 -0
- getanyapi/platforms/indeed.py +114 -0
- getanyapi/platforms/instagram.py +1868 -0
- getanyapi/platforms/linkedin.py +1064 -0
- getanyapi/platforms/maps.py +412 -0
- getanyapi/platforms/pandaexpress.py +262 -0
- getanyapi/platforms/person.py +96 -0
- getanyapi/platforms/pinterest.py +96 -0
- getanyapi/platforms/playstore.py +99 -0
- getanyapi/platforms/polymarket.py +109 -0
- getanyapi/platforms/realtor.py +104 -0
- getanyapi/platforms/reddit.py +582 -0
- getanyapi/platforms/redfin.py +95 -0
- getanyapi/platforms/rednote.py +807 -0
- getanyapi/platforms/sec.py +118 -0
- getanyapi/platforms/semrush.py +358 -0
- getanyapi/platforms/snapchat.py +146 -0
- getanyapi/platforms/social.py +105 -0
- getanyapi/platforms/spotify.py +588 -0
- getanyapi/platforms/substack.py +142 -0
- getanyapi/platforms/threads.py +358 -0
- getanyapi/platforms/tiktok.py +1827 -0
- getanyapi/platforms/tiktok_shop.py +536 -0
- getanyapi/platforms/tripadvisor.py +180 -0
- getanyapi/platforms/trustpilot.py +114 -0
- getanyapi/platforms/truthsocial.py +226 -0
- getanyapi/platforms/twitter.py +798 -0
- getanyapi/platforms/upwork.py +119 -0
- getanyapi/platforms/walmart.py +93 -0
- getanyapi/platforms/web.py +264 -0
- getanyapi/platforms/whatsapp.py +91 -0
- getanyapi/platforms/yahoo_finance.py +95 -0
- getanyapi/platforms/yelp.py +141 -0
- getanyapi/platforms/youtube.py +1452 -0
- getanyapi/platforms/zillow.py +218 -0
- getanyapi/py.typed +0 -0
- getanyapi/types.py +170 -0
- getanyapi-0.1.0.dist-info/METADATA +155 -0
- getanyapi-0.1.0.dist-info/RECORD +68 -0
- getanyapi-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Generated - do not edit. Regenerate with: pnpm generate
|
|
2
|
+
"""Generated namespace module for the substack platform."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from typing import Literal, 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
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from .._async_client import AsyncAnyAPI
|
|
15
|
+
from .._client import AnyAPI
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class SubstackPostsInput(TypedDict, total=False):
|
|
19
|
+
"""Input for Substack Posts."""
|
|
20
|
+
|
|
21
|
+
contentType: NotRequired[Literal["all", "newsletter", "podcast", "thread"]]
|
|
22
|
+
"""Restrict to a single post type, or 'all' (e.g. newsletter). Default: all."""
|
|
23
|
+
includeContent: NotRequired[bool]
|
|
24
|
+
"""Include the full article body as HTML. Set false for metadata only (e.g. false). Default: true."""
|
|
25
|
+
limit: NotRequired[int]
|
|
26
|
+
"""Maximum number of recent posts to return when given a publication URL (1-100, default 25); ignored for a single post URL, which always returns that one post. You are billed per post returned, so a lower limit costs less. Range: 1 to 100."""
|
|
27
|
+
onlyFree: NotRequired[bool]
|
|
28
|
+
"""Return only free (non-paywalled) posts (e.g. true). Default: false."""
|
|
29
|
+
url: Required[str]
|
|
30
|
+
"""Either a Substack publication URL / custom domain to fetch its recent posts (e.g. https://www.astralcodexten.com), OR a single post URL to fetch just that one article with full content (e.g. https://www.astralcodexten.com/p/your-book-review)."""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class SubstackPostsData(BaseModel):
|
|
34
|
+
items: list[SubstackPostsItem] = Field(
|
|
35
|
+
description="Post records: title, subtitle, URL, publish date, paywall status, word count, engagement (reactions, comments, restacks), author profile, publication info, and full article HTML when requested."
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class SubstackPostsItem(BaseModel):
|
|
40
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
41
|
+
|
|
42
|
+
author_handle: str | None = Field(
|
|
43
|
+
default=None,
|
|
44
|
+
alias="authorHandle",
|
|
45
|
+
description="Present whenever the upstream returns this record.",
|
|
46
|
+
)
|
|
47
|
+
author_name: str | None = Field(
|
|
48
|
+
default=None,
|
|
49
|
+
alias="authorName",
|
|
50
|
+
description="Present whenever the upstream returns this record.",
|
|
51
|
+
)
|
|
52
|
+
comment_count: int | None = Field(default=None, alias="commentCount")
|
|
53
|
+
description: str | None = Field(
|
|
54
|
+
default=None, description="Present whenever the upstream returns this record."
|
|
55
|
+
)
|
|
56
|
+
image: str | None = Field(
|
|
57
|
+
default=None,
|
|
58
|
+
description="Cover image URL. Present whenever the upstream returns this record.",
|
|
59
|
+
)
|
|
60
|
+
is_paid: bool | None = Field(default=None, alias="isPaid")
|
|
61
|
+
post_id: str | None = Field(
|
|
62
|
+
default=None,
|
|
63
|
+
alias="postId",
|
|
64
|
+
description="Present whenever the upstream returns this record.",
|
|
65
|
+
)
|
|
66
|
+
post_type: str | None = Field(
|
|
67
|
+
default=None,
|
|
68
|
+
alias="postType",
|
|
69
|
+
description="Present whenever the upstream returns this record.",
|
|
70
|
+
)
|
|
71
|
+
published_at: str | None = Field(
|
|
72
|
+
default=None,
|
|
73
|
+
alias="publishedAt",
|
|
74
|
+
description="ISO 8601 publish date. Present whenever the upstream returns this record.",
|
|
75
|
+
)
|
|
76
|
+
reaction_count: int | None = Field(default=None, alias="reactionCount")
|
|
77
|
+
subtitle: str | None = Field(
|
|
78
|
+
default=None, description="Present whenever the upstream returns this record."
|
|
79
|
+
)
|
|
80
|
+
title: str
|
|
81
|
+
url: str
|
|
82
|
+
wordcount: int | None = None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class SubstackNamespace:
|
|
86
|
+
"""Typed methods for this platform. Attached lazily to the client."""
|
|
87
|
+
|
|
88
|
+
def __init__(self, client: "AnyAPI") -> None:
|
|
89
|
+
self._client = client
|
|
90
|
+
|
|
91
|
+
def posts(
|
|
92
|
+
self,
|
|
93
|
+
*,
|
|
94
|
+
options: RequestOptions | None = None,
|
|
95
|
+
**input: Unpack[SubstackPostsInput],
|
|
96
|
+
) -> RunResult[SubstackPostsData]:
|
|
97
|
+
"""Substack Posts
|
|
98
|
+
|
|
99
|
+
Pull posts from any Substack publication by its URL - or pass a single post
|
|
100
|
+
URL (…/p/slug) to fetch just that one article. Returns title, subtitle,
|
|
101
|
+
publish date, paywall status, word count, engagement (reactions, comments,
|
|
102
|
+
restacks), author profile, and full article HTML. Priced per post returned.
|
|
103
|
+
|
|
104
|
+
Price: $0.005 per request plus $0.00156 per result.
|
|
105
|
+
|
|
106
|
+
Example:
|
|
107
|
+
res = client.substack.posts(limit=3, url="https://www.astralcodexten.com")
|
|
108
|
+
"""
|
|
109
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
110
|
+
"substack.posts", dict(input), options
|
|
111
|
+
)
|
|
112
|
+
return RunResult[SubstackPostsData].model_validate(raw)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class AsyncSubstackNamespace:
|
|
116
|
+
"""Typed methods for this platform. Attached lazily to the client."""
|
|
117
|
+
|
|
118
|
+
def __init__(self, client: "AsyncAnyAPI") -> None:
|
|
119
|
+
self._client = client
|
|
120
|
+
|
|
121
|
+
async def posts(
|
|
122
|
+
self,
|
|
123
|
+
*,
|
|
124
|
+
options: RequestOptions | None = None,
|
|
125
|
+
**input: Unpack[SubstackPostsInput],
|
|
126
|
+
) -> RunResult[SubstackPostsData]:
|
|
127
|
+
"""Substack Posts
|
|
128
|
+
|
|
129
|
+
Pull posts from any Substack publication by its URL - or pass a single post
|
|
130
|
+
URL (…/p/slug) to fetch just that one article. Returns title, subtitle,
|
|
131
|
+
publish date, paywall status, word count, engagement (reactions, comments,
|
|
132
|
+
restacks), author profile, and full article HTML. Priced per post returned.
|
|
133
|
+
|
|
134
|
+
Price: $0.005 per request plus $0.00156 per result.
|
|
135
|
+
|
|
136
|
+
Example:
|
|
137
|
+
res = client.substack.posts(limit=3, url="https://www.astralcodexten.com")
|
|
138
|
+
"""
|
|
139
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
140
|
+
"substack.posts", dict(input), options
|
|
141
|
+
)
|
|
142
|
+
return RunResult[SubstackPostsData].model_validate(raw)
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
# Generated - do not edit. Regenerate with: pnpm generate
|
|
2
|
+
"""Generated namespace module for the threads 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 Required, TypedDict, Unpack
|
|
10
|
+
|
|
11
|
+
from ..types import RequestOptions, RunResult
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from .._async_client import AsyncAnyAPI
|
|
15
|
+
from .._client import AnyAPI
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ThreadsPostInput(TypedDict, total=False):
|
|
19
|
+
"""Input for Threads Post."""
|
|
20
|
+
|
|
21
|
+
url: Required[str]
|
|
22
|
+
"""The full URL of the Threads post to fetch (e.g. https://www.threads.com/@zuck/post/C8yKXdRxKqK)."""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ThreadsProfileInput(TypedDict, total=False):
|
|
26
|
+
"""Input for Threads Profile."""
|
|
27
|
+
|
|
28
|
+
username: Required[str]
|
|
29
|
+
"""The Threads username to look up, without the @ prefix (e.g. zuck)."""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ThreadsSearchInput(TypedDict, total=False):
|
|
33
|
+
"""Input for Threads Search."""
|
|
34
|
+
|
|
35
|
+
query: Required[str]
|
|
36
|
+
"""Keyword or hashtag to search public Threads posts for; the # prefix is optional (e.g. AI agents)."""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class ThreadsSearchUsersInput(TypedDict, total=False):
|
|
40
|
+
"""Input for Threads User Search."""
|
|
41
|
+
|
|
42
|
+
query: Required[str]
|
|
43
|
+
"""The name or username to search Threads users for."""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class ThreadsUserPostsInput(TypedDict, total=False):
|
|
47
|
+
"""Input for Threads User Posts."""
|
|
48
|
+
|
|
49
|
+
handle: Required[str]
|
|
50
|
+
"""The Threads username to list posts for, without the @ prefix."""
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class ThreadsPostData(BaseModel):
|
|
54
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
55
|
+
|
|
56
|
+
code: str
|
|
57
|
+
full_name: str = Field(alias="fullName")
|
|
58
|
+
id: str
|
|
59
|
+
like_count: int = Field(alias="likeCount")
|
|
60
|
+
quote_count: int = Field(alias="quoteCount")
|
|
61
|
+
reply_count: int = Field(alias="replyCount")
|
|
62
|
+
repost_count: int = Field(alias="repostCount")
|
|
63
|
+
taken_at: int = Field(alias="takenAt")
|
|
64
|
+
text: str
|
|
65
|
+
username: str
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class ThreadsProfileData(BaseModel):
|
|
69
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
70
|
+
|
|
71
|
+
biography: str
|
|
72
|
+
follower_count: int = Field(alias="followerCount")
|
|
73
|
+
full_name: str = Field(alias="fullName")
|
|
74
|
+
id: str
|
|
75
|
+
is_private: bool = Field(alias="isPrivate")
|
|
76
|
+
is_verified: bool = Field(alias="isVerified")
|
|
77
|
+
profile_pic_url: str = Field(alias="profilePicUrl")
|
|
78
|
+
username: str
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class ThreadsSearchData(BaseModel):
|
|
82
|
+
posts: list[ThreadsSearchPost] = Field(
|
|
83
|
+
description="Matching public post records: text, author, engagement counts, timestamp, and URL."
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class ThreadsSearchPost(BaseModel):
|
|
88
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
89
|
+
|
|
90
|
+
code: str
|
|
91
|
+
full_name: str = Field(alias="fullName")
|
|
92
|
+
id: str
|
|
93
|
+
like_count: int = Field(alias="likeCount")
|
|
94
|
+
reply_count: int = Field(alias="replyCount")
|
|
95
|
+
repost_count: int = Field(alias="repostCount")
|
|
96
|
+
taken_at: int = Field(alias="takenAt")
|
|
97
|
+
text: str
|
|
98
|
+
url: str
|
|
99
|
+
username: str
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class ThreadsSearchUsersData(BaseModel):
|
|
103
|
+
users: list[ThreadsSearchUsersUser]
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class ThreadsSearchUsersUser(BaseModel):
|
|
107
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
108
|
+
|
|
109
|
+
full_name: str = Field(alias="fullName")
|
|
110
|
+
id: str
|
|
111
|
+
is_verified: bool = Field(alias="isVerified")
|
|
112
|
+
profile_pic_url: str = Field(alias="profilePicUrl")
|
|
113
|
+
username: str
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class ThreadsUserPostsData(BaseModel):
|
|
117
|
+
posts: list[ThreadsUserPostsPost]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class ThreadsUserPostsPost(BaseModel):
|
|
121
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
122
|
+
|
|
123
|
+
code: str
|
|
124
|
+
id: str
|
|
125
|
+
like_count: int = Field(alias="likeCount")
|
|
126
|
+
quote_count: int = Field(alias="quoteCount")
|
|
127
|
+
reply_count: int = Field(alias="replyCount")
|
|
128
|
+
repost_count: int = Field(alias="repostCount")
|
|
129
|
+
taken_at: int = Field(alias="takenAt")
|
|
130
|
+
text: str
|
|
131
|
+
url: str
|
|
132
|
+
username: str
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class ThreadsNamespace:
|
|
136
|
+
"""Typed methods for this platform. Attached lazily to the client."""
|
|
137
|
+
|
|
138
|
+
def __init__(self, client: "AnyAPI") -> None:
|
|
139
|
+
self._client = client
|
|
140
|
+
|
|
141
|
+
def post(
|
|
142
|
+
self,
|
|
143
|
+
*,
|
|
144
|
+
options: RequestOptions | None = None,
|
|
145
|
+
**input: Unpack[ThreadsPostInput],
|
|
146
|
+
) -> RunResult[ThreadsPostData]:
|
|
147
|
+
"""Threads Post
|
|
148
|
+
|
|
149
|
+
Fetch a single Threads post by URL - text, author, engagement counts, and
|
|
150
|
+
timestamp - billed per request in USD.
|
|
151
|
+
|
|
152
|
+
Price: $0.002 per request.
|
|
153
|
+
|
|
154
|
+
Example:
|
|
155
|
+
res = client.threads.post(url="https://www.threads.com/@aaronparnas/post/DZxPYVFkYSq")
|
|
156
|
+
"""
|
|
157
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
158
|
+
"threads.post", dict(input), options
|
|
159
|
+
)
|
|
160
|
+
return RunResult[ThreadsPostData].model_validate(raw)
|
|
161
|
+
|
|
162
|
+
def profile(
|
|
163
|
+
self,
|
|
164
|
+
*,
|
|
165
|
+
options: RequestOptions | None = None,
|
|
166
|
+
**input: Unpack[ThreadsProfileInput],
|
|
167
|
+
) -> RunResult[ThreadsProfileData]:
|
|
168
|
+
"""Threads Profile
|
|
169
|
+
|
|
170
|
+
Fetch a Threads user's public profile (bio, follower count, verification,
|
|
171
|
+
profile picture) by username, billed per request in USD.
|
|
172
|
+
|
|
173
|
+
Price: $0.002 per request.
|
|
174
|
+
|
|
175
|
+
Example:
|
|
176
|
+
res = client.threads.profile(username="zuck")
|
|
177
|
+
"""
|
|
178
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
179
|
+
"threads.profile", dict(input), options
|
|
180
|
+
)
|
|
181
|
+
return RunResult[ThreadsProfileData].model_validate(raw)
|
|
182
|
+
|
|
183
|
+
def search(
|
|
184
|
+
self,
|
|
185
|
+
*,
|
|
186
|
+
options: RequestOptions | None = None,
|
|
187
|
+
**input: Unpack[ThreadsSearchInput],
|
|
188
|
+
) -> RunResult[ThreadsSearchData]:
|
|
189
|
+
"""Threads Search
|
|
190
|
+
|
|
191
|
+
Search public Threads posts by keyword or hashtag and get normalized post
|
|
192
|
+
records - text, author, and engagement - billed per request in USD.
|
|
193
|
+
|
|
194
|
+
Price: $0.002 per request.
|
|
195
|
+
|
|
196
|
+
Example:
|
|
197
|
+
res = client.threads.search(query="trump")
|
|
198
|
+
"""
|
|
199
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
200
|
+
"threads.search", dict(input), options
|
|
201
|
+
)
|
|
202
|
+
return RunResult[ThreadsSearchData].model_validate(raw)
|
|
203
|
+
|
|
204
|
+
def search_users(
|
|
205
|
+
self,
|
|
206
|
+
*,
|
|
207
|
+
options: RequestOptions | None = None,
|
|
208
|
+
**input: Unpack[ThreadsSearchUsersInput],
|
|
209
|
+
) -> RunResult[ThreadsSearchUsersData]:
|
|
210
|
+
"""Threads User Search
|
|
211
|
+
|
|
212
|
+
Search Threads users by name or username and get normalized profile records
|
|
213
|
+
- username, full name, verification, and picture - at a flat per-request USD
|
|
214
|
+
price.
|
|
215
|
+
|
|
216
|
+
Price: $0.002 per request.
|
|
217
|
+
|
|
218
|
+
Example:
|
|
219
|
+
res = client.threads.search_users(query="shams")
|
|
220
|
+
"""
|
|
221
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
222
|
+
"threads.search_users", dict(input), options
|
|
223
|
+
)
|
|
224
|
+
return RunResult[ThreadsSearchUsersData].model_validate(raw)
|
|
225
|
+
|
|
226
|
+
def user_posts(
|
|
227
|
+
self,
|
|
228
|
+
*,
|
|
229
|
+
options: RequestOptions | None = None,
|
|
230
|
+
**input: Unpack[ThreadsUserPostsInput],
|
|
231
|
+
) -> RunResult[ThreadsUserPostsData]:
|
|
232
|
+
"""Threads User Posts
|
|
233
|
+
|
|
234
|
+
List a Threads user's recent public posts by username - text, engagement
|
|
235
|
+
counts, and post URLs - at a flat per-request USD price.
|
|
236
|
+
|
|
237
|
+
Price: $0.002 per request.
|
|
238
|
+
|
|
239
|
+
Example:
|
|
240
|
+
res = client.threads.user_posts(handle="trendspider")
|
|
241
|
+
"""
|
|
242
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
243
|
+
"threads.user_posts", dict(input), options
|
|
244
|
+
)
|
|
245
|
+
return RunResult[ThreadsUserPostsData].model_validate(raw)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class AsyncThreadsNamespace:
|
|
249
|
+
"""Typed methods for this platform. Attached lazily to the client."""
|
|
250
|
+
|
|
251
|
+
def __init__(self, client: "AsyncAnyAPI") -> None:
|
|
252
|
+
self._client = client
|
|
253
|
+
|
|
254
|
+
async def post(
|
|
255
|
+
self,
|
|
256
|
+
*,
|
|
257
|
+
options: RequestOptions | None = None,
|
|
258
|
+
**input: Unpack[ThreadsPostInput],
|
|
259
|
+
) -> RunResult[ThreadsPostData]:
|
|
260
|
+
"""Threads Post
|
|
261
|
+
|
|
262
|
+
Fetch a single Threads post by URL - text, author, engagement counts, and
|
|
263
|
+
timestamp - billed per request in USD.
|
|
264
|
+
|
|
265
|
+
Price: $0.002 per request.
|
|
266
|
+
|
|
267
|
+
Example:
|
|
268
|
+
res = client.threads.post(url="https://www.threads.com/@aaronparnas/post/DZxPYVFkYSq")
|
|
269
|
+
"""
|
|
270
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
271
|
+
"threads.post", dict(input), options
|
|
272
|
+
)
|
|
273
|
+
return RunResult[ThreadsPostData].model_validate(raw)
|
|
274
|
+
|
|
275
|
+
async def profile(
|
|
276
|
+
self,
|
|
277
|
+
*,
|
|
278
|
+
options: RequestOptions | None = None,
|
|
279
|
+
**input: Unpack[ThreadsProfileInput],
|
|
280
|
+
) -> RunResult[ThreadsProfileData]:
|
|
281
|
+
"""Threads Profile
|
|
282
|
+
|
|
283
|
+
Fetch a Threads user's public profile (bio, follower count, verification,
|
|
284
|
+
profile picture) by username, billed per request in USD.
|
|
285
|
+
|
|
286
|
+
Price: $0.002 per request.
|
|
287
|
+
|
|
288
|
+
Example:
|
|
289
|
+
res = client.threads.profile(username="zuck")
|
|
290
|
+
"""
|
|
291
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
292
|
+
"threads.profile", dict(input), options
|
|
293
|
+
)
|
|
294
|
+
return RunResult[ThreadsProfileData].model_validate(raw)
|
|
295
|
+
|
|
296
|
+
async def search(
|
|
297
|
+
self,
|
|
298
|
+
*,
|
|
299
|
+
options: RequestOptions | None = None,
|
|
300
|
+
**input: Unpack[ThreadsSearchInput],
|
|
301
|
+
) -> RunResult[ThreadsSearchData]:
|
|
302
|
+
"""Threads Search
|
|
303
|
+
|
|
304
|
+
Search public Threads posts by keyword or hashtag and get normalized post
|
|
305
|
+
records - text, author, and engagement - billed per request in USD.
|
|
306
|
+
|
|
307
|
+
Price: $0.002 per request.
|
|
308
|
+
|
|
309
|
+
Example:
|
|
310
|
+
res = client.threads.search(query="trump")
|
|
311
|
+
"""
|
|
312
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
313
|
+
"threads.search", dict(input), options
|
|
314
|
+
)
|
|
315
|
+
return RunResult[ThreadsSearchData].model_validate(raw)
|
|
316
|
+
|
|
317
|
+
async def search_users(
|
|
318
|
+
self,
|
|
319
|
+
*,
|
|
320
|
+
options: RequestOptions | None = None,
|
|
321
|
+
**input: Unpack[ThreadsSearchUsersInput],
|
|
322
|
+
) -> RunResult[ThreadsSearchUsersData]:
|
|
323
|
+
"""Threads User Search
|
|
324
|
+
|
|
325
|
+
Search Threads users by name or username and get normalized profile records
|
|
326
|
+
- username, full name, verification, and picture - at a flat per-request USD
|
|
327
|
+
price.
|
|
328
|
+
|
|
329
|
+
Price: $0.002 per request.
|
|
330
|
+
|
|
331
|
+
Example:
|
|
332
|
+
res = client.threads.search_users(query="shams")
|
|
333
|
+
"""
|
|
334
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
335
|
+
"threads.search_users", dict(input), options
|
|
336
|
+
)
|
|
337
|
+
return RunResult[ThreadsSearchUsersData].model_validate(raw)
|
|
338
|
+
|
|
339
|
+
async def user_posts(
|
|
340
|
+
self,
|
|
341
|
+
*,
|
|
342
|
+
options: RequestOptions | None = None,
|
|
343
|
+
**input: Unpack[ThreadsUserPostsInput],
|
|
344
|
+
) -> RunResult[ThreadsUserPostsData]:
|
|
345
|
+
"""Threads User Posts
|
|
346
|
+
|
|
347
|
+
List a Threads user's recent public posts by username - text, engagement
|
|
348
|
+
counts, and post URLs - at a flat per-request USD price.
|
|
349
|
+
|
|
350
|
+
Price: $0.002 per request.
|
|
351
|
+
|
|
352
|
+
Example:
|
|
353
|
+
res = client.threads.user_posts(handle="trendspider")
|
|
354
|
+
"""
|
|
355
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
356
|
+
"threads.user_posts", dict(input), options
|
|
357
|
+
)
|
|
358
|
+
return RunResult[ThreadsUserPostsData].model_validate(raw)
|