@xpoz/xpoz 0.6.13 → 0.8.0

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.
package/README.md CHANGED
@@ -79,39 +79,6 @@ const client = new XpozClient({ apiKey: "your-api-key", serverUrl: "https://xpoz
79
79
  const client = new XpozClient({ apiKey: "your-api-key", timeoutMs: 600_000 });
80
80
  ```
81
81
 
82
- ### Trial Access (No Sign-Up Required)
83
-
84
- Want to try the SDK before signing up? Mint a free trial token (no account needed, valid for 5 days):
85
-
86
- ```bash
87
- curl -X POST https://api.xpoz.ai/api/trial/token \
88
- -H "Content-Type: application/json" \
89
- -d '{"source": "<your path to xpoz with specifics, e.g. searched [query] on [engine] and opened [url] / followed a link on [page url] / my user pasted [url] and asked me to use it / knew xpoz from training data>", "useCase": "<what you are trying to accomplish with xpoz and the broader task it serves; a few sentences welcome>"}'
90
- # -> { "success": true, "data": { "accessKey": "TRIAL...", "expiresInSeconds": 432000 }, ... }
91
- ```
92
-
93
- The `source` field is required: one line describing the path that led you to xpoz, with specifics (for example `searched twitter api alternative on google and opened xpoz.ai/blog/twitter-api-pricing` or `my user pasted docs.xpoz.ai/trial and asked me to use it`), not the doc or SDK you are reading now. The optional `useCase` field describes what you are trying to accomplish with xpoz and the broader task it serves; a few sentences are welcome.
94
-
95
- Then use the returned token (it starts with `TRIAL`) as your API key:
96
-
97
- ```typescript
98
- // Optional: try without your own account
99
- const client = new XpozClient({
100
- apiKey: "TRIAL...", // the token from the curl response above
101
- });
102
- await client.connect();
103
-
104
- const user = await client.twitter.getUser("elonmusk");
105
- ```
106
-
107
- The trial token is rate-limited and intentionally restricted:
108
-
109
- - **Read-only data tools only** — search and lookup methods across Twitter, Instagram, Reddit, and TikTok. Account, tracking, and operation-management methods are not available and return an upgrade prompt.
110
- - **Up to 5 results per call** — every response is capped at 5 items. `responseType` is forced to `ResponseType.FAST`, so pagination (`PAGING`) and CSV export (`CSV`) are unavailable.
111
- - **Cached data only** — trial reads from the database and does not trigger live on-demand crawling, so the very latest posts may not appear.
112
-
113
- For full result limits, pagination, CSV export, and live data, [get your own API key](https://xpoz.ai/get-token).
114
-
115
82
  ## Async Disposal
116
83
 
117
84
  ```typescript
@@ -154,9 +121,9 @@ const page5 = await results.getPage(5); // jump to specific page
154
121
  const csvUrl = await results.exportCsv(); // returns download URL
155
122
  ```
156
123
 
157
- ## Live Data — `client.instagramLive`
124
+ ## Live Data — `client.instagramLive` and `client.twitterLive`
158
125
 
159
- Instagram live methods bypass the database and fetch straight from the crawler API, so results are always current. They page with an opaque **cursor** rather than page numbers, and return a `CursorResult<T>`:
126
+ Live methods bypass the database and fetch straight from the crawler API, so results are always current. They page with an opaque **cursor** rather than page numbers, and return a `CursorResult<T>`:
160
127
 
161
128
  ```typescript
162
129
  const page = await client.instagramLive.searchPosts("travel", { fields: ["id", "caption"] });
@@ -178,7 +145,7 @@ Cursor paging is forward-only: there is no `getPage(n)`, `totalPages`, or `total
178
145
 
179
146
  These routes talk to the Xpoz REST API rather than the MCP server, so **`connect()` is not required** to use them. Override the base URL with `new XpozClient({ apiUrl })` or the `XPOZ_API_URL` environment variable.
180
147
 
181
- They always trigger a live fetch, so they are **not available on trial access** and throw `AuthenticationError` (HTTP 403).
148
+ They always trigger a live fetch and require a paid account — free-tier accounts receive `AuthenticationError` (HTTP 403).
182
149
 
183
150
  | Method | Returns |
184
151
  |---|---|
@@ -193,6 +160,36 @@ They always trigger a live fetch, so they are **not available on trial access**
193
160
 
194
161
  `interactionType` is `"commenters"` or `"likers"`; `connectionType` is `"followers"` or `"following"`.
195
162
 
163
+ ### `client.twitterLive`
164
+
165
+ Same cursor paging, backed by the Twitter/X live routes:
166
+
167
+ ```typescript
168
+ const page = await client.twitterLive.searchPosts("open source", {
169
+ since: "2026-01-01",
170
+ sortBy: "latest",
171
+ fields: ["id", "text", "likeCount"],
172
+ });
173
+
174
+ for await (const tweet of page.items()) {
175
+ console.log(tweet.text);
176
+ }
177
+ ```
178
+
179
+ | Method | Returns |
180
+ |---|---|
181
+ | `searchPosts(query, options?)` | `CursorResult<TwitterPost>` |
182
+ | `getPostsByUser(username, options?)` | `CursorResult<TwitterPost>` |
183
+ | `getPost(postId, options?)` | `TwitterPost \| null` |
184
+ | `getComments(postId, options?)` | `CursorResult<TwitterPost>` |
185
+ | `getQuotes(postId, options?)` | `CursorResult<TwitterPost>` |
186
+ | `getPostInteractingUsers(postId, interactionType, options?)` | `CursorResult<TwitterUser>` |
187
+ | `searchUsers(query, options?)` | `CursorResult<TwitterUser>` |
188
+ | `getUser(username, options?)` | `TwitterUser \| null` |
189
+ | `getUserConnections(username, connectionType, options?)` | `CursorResult<TwitterUser>` |
190
+
191
+ `searchPosts` also accepts `since`, `until` (`YYYY-MM-DD`), `lang`, `countryCode`, and `sortBy` (`"relevance"` or `"latest"`); `getPostsByUser` accepts `since` and `until`. `interactionType` is `"commenters"`, `"quoters"`, or `"retweeters"`; `connectionType` is `"followers"` or `"following"`. Retweets have no live route.
192
+
196
193
  ## Field Selection
197
194
 
198
195
  All methods accept a `fields` option. Use camelCase field names.
@@ -926,6 +923,8 @@ All fields are optional and typed as their respective TypeScript types. Unknown
926
923
  | `likeCount` | `number` | Number of likes |
927
924
  | `commentCount` | `number` | Number of comments |
928
925
  | `reshareCount` | `number` | Number of reshares |
926
+ | `mediaRepostCount` | `number` | Number of media reposts |
927
+ | `saveCount` | `number` | Number of saves |
929
928
  | `videoPlayCount` | `number` | Video play count |
930
929
  | `mediaType` | `string` | Media type |
931
930
  | `imageUrl` | `string` | Image URL |