xapi-to 0.1.18 → 0.1.20
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/LICENSE +21 -0
- package/README.md +258 -10
- package/dist/chunk-TYY6JR6O.js +870 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1256 -590
- package/dist/openai-sandbox-client.d.ts +85 -0
- package/dist/openai-sandbox-client.js +285 -0
- package/examples/openai-agents-sandbox-local.ts +131 -0
- package/examples/sandbox-api-cli-openai.mjs +450 -0
- package/package.json +33 -4
- package/scripts/openai-sandbox-agent-e2e.ts +219 -0
- package/scripts/sandbox-playground-e2e.mjs +463 -0
- package/skills/xapi/SKILL.md +498 -0
- package/skills/xapi/guides/ai.md +200 -0
- package/skills/xapi/guides/ai_gateway.md +263 -0
- package/skills/xapi/guides/crypto.md +197 -0
- package/skills/xapi/guides/douyin.md +297 -0
- package/skills/xapi/guides/google_search.md +194 -0
- package/skills/xapi/guides/linkedin.md +253 -0
- package/skills/xapi/guides/reddit.md +312 -0
- package/skills/xapi/guides/sandbox.md +466 -0
- package/skills/xapi/guides/serper.md +124 -0
- package/skills/xapi/guides/sms.md +186 -0
- package/skills/xapi/guides/tiktok.md +322 -0
- package/skills/xapi/guides/twitter.md +276 -0
- package/skills/xapi/guides/weibo.md +301 -0
- package/skills/xapi/guides/ws_gateway.md +206 -0
- package/skills/xapi/guides/xiaohongshu.md +315 -0
- package/skills/xapi/scripts/download_tweet_videos.sh +125 -0
- package/src/client.ts +664 -0
- package/src/config.ts +160 -0
- package/src/openai-sandbox-client.ts +349 -0
- package/src/sandbox-client.ts +289 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# Douyin (抖音) Guide
|
|
2
|
+
|
|
3
|
+
Complete guide for Douyin (抖音) operations via xAPI — user profiles, videos, comments, hot search, hashtags, music, and video statistics.
|
|
4
|
+
|
|
5
|
+
> **Dynamic catalog:** These are database-registered third-party APIs under the `douyin` service. Exact action IDs, HTTP methods, parameters, and response fields can change. Run `search` and `get` before calling; the current schema wins. Examples below reflect one known GET-based version and keep `"method":"GET"` in the input for compatibility.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- [User data](#user-data)
|
|
10
|
+
- [Video data](#video-data)
|
|
11
|
+
- [Video mixes](#video-mix-合集)
|
|
12
|
+
- [Hot search](#hot-search-热搜)
|
|
13
|
+
- [Hashtags](#hashtags)
|
|
14
|
+
- [Music](#music)
|
|
15
|
+
- [Common workflows](#common-workflows)
|
|
16
|
+
- [Pagination](#pagination-patterns)
|
|
17
|
+
- [API reference](#api-reference)
|
|
18
|
+
- [Error handling](#error-handling)
|
|
19
|
+
|
|
20
|
+
## User Data
|
|
21
|
+
|
|
22
|
+
### Get user profile
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_handler__user__profile \
|
|
26
|
+
--input '{"method":"GET","params":{"sec_user_id":"<sec_user_id>"}}'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Requires `sec_user_id`. Returns user info at `data.data.user`.
|
|
30
|
+
|
|
31
|
+
### Get user's videos
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__user__post__videos \
|
|
35
|
+
--input '{"method":"GET","params":{"sec_user_id":"<sec_user_id>","count":10}}'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Requires `sec_user_id`. Paginate with `max_cursor`. Optional: `sort_type`.
|
|
39
|
+
|
|
40
|
+
### Get user's liked videos
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__user__like__videos \
|
|
44
|
+
--input '{"method":"GET","params":{"sec_user_id":"<sec_user_id>","counts":10}}'
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Requires `sec_user_id`. Paginate with `max_cursor`. Note: the parameter is `counts` (with 's'), not `count`.
|
|
48
|
+
|
|
49
|
+
### Get user fans list
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__user__fans__list \
|
|
53
|
+
--input '{"method":"GET","params":{"sec_user_id":"<sec_user_id>","count":20}}'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Paginate with `max_time`.
|
|
57
|
+
|
|
58
|
+
### Get user series list
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__user__series__list \
|
|
62
|
+
--input '{"method":"GET","params":{"sec_user_id":"<sec_user_id>"}}'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Video Data
|
|
66
|
+
|
|
67
|
+
### Get video by ID
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__one__video \
|
|
71
|
+
--input '{"method":"GET","params":{"aweme_id":"<video_id>"}}'
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Also available: V2 (`fetch__one__video__v2`) and V3 (`fetch__one__video__v3`, no copyright restrictions).
|
|
75
|
+
|
|
76
|
+
### Get video by share URL
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__one__video__by__share__url \
|
|
80
|
+
--input '{"method":"GET","params":{"share_url":"https://v.douyin.com/xxxxx/"}}'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Batch get videos
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__multi__video \
|
|
87
|
+
--input '{"method":"GET","params":{"aweme_ids":"id1,id2,id3"}}'
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Also available: V2 (`fetch__multi__video__v2`).
|
|
91
|
+
|
|
92
|
+
### Get video statistics
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__video__statistics \
|
|
96
|
+
--input '{"method":"GET","params":{"aweme_ids":"<video_id>"}}'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Returns like count, download count, play count, share count. Supports comma-separated IDs for batch queries.
|
|
100
|
+
|
|
101
|
+
### Get high quality play URL
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__video__high__quality__play__url \
|
|
105
|
+
--input '{"method":"GET","params":{"aweme_id":"<video_id>"}}'
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Returns the highest quality video play URL.
|
|
109
|
+
|
|
110
|
+
### Get video comments
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__video__comments \
|
|
114
|
+
--input '{"method":"GET","params":{"aweme_id":"<video_id>","count":20,"cursor":0}}'
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Paginate with `cursor`.
|
|
118
|
+
|
|
119
|
+
### Get comment replies
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__video__comment__replies \
|
|
123
|
+
--input '{"method":"GET","params":{"item_id":"<video_id>","comment_id":"<comment_id>","count":20,"cursor":0}}'
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Video Mix (合集)
|
|
127
|
+
|
|
128
|
+
### Get video mix detail
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__video__mix__detail \
|
|
132
|
+
--input '{"method":"GET","params":{"mix_id":"<mix_id>"}}'
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Get video mix post list
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__video__mix__post__list \
|
|
139
|
+
--input '{"method":"GET","params":{"mix_id":"<mix_id>","count":20,"cursor":0}}'
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Paginate with `cursor`.
|
|
143
|
+
|
|
144
|
+
### Get series detail
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__series__detail \
|
|
148
|
+
--input '{"method":"GET","params":{"series_id":"<series_id>"}}'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Get series video list
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__series__video__list \
|
|
155
|
+
--input '{"method":"GET","params":{"series_id":"<series_id>"}}'
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Hot Search (热搜)
|
|
159
|
+
|
|
160
|
+
### Get Douyin hot search list
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__hot__search__list \
|
|
164
|
+
--input '{"method":"GET","params":{}}'
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Returns ~50 trending topics at `data.data.data.word_list[]`. Most entries have fields: `word` (topic title), `hot_value`, `view_count`, `event_time`, `position`. Pinned/top entries may only have `word`, `hot_value`, `view_count` without `event_time` or `position`.
|
|
168
|
+
|
|
169
|
+
Optional: `board_type`, `board_sub_type` for different ranking categories.
|
|
170
|
+
|
|
171
|
+
### Get brand hot search list
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__brand__hot__search__list \
|
|
175
|
+
--input '{"method":"GET","params":{}}'
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Get live hot search list
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__live__hot__search__list \
|
|
182
|
+
--input '{"method":"GET","params":{}}'
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Hashtags
|
|
186
|
+
|
|
187
|
+
### Get hashtag details
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__hashtag__detail \
|
|
191
|
+
--input '{"method":"GET","params":{"ch_id":123456}}'
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Note: `ch_id` is an **integer** for Douyin.
|
|
195
|
+
|
|
196
|
+
### Get hashtag video list
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__hashtag__video__list \
|
|
200
|
+
--input '{"method":"GET","params":{"ch_id":"<hashtag_id>","count":20,"cursor":0}}'
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Optional: `sort_type` — `0` = comprehensive, `1` = most likes, `2` = latest first.
|
|
204
|
+
|
|
205
|
+
## Music
|
|
206
|
+
|
|
207
|
+
### Get music details
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__music__detail \
|
|
211
|
+
--input '{"method":"GET","params":{"music_id":"<music_id>"}}'
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Get music video list
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__music__video__list \
|
|
218
|
+
--input '{"method":"GET","params":{"music_id":"<music_id>"}}'
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Get music hot search list
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
npx xapi-to call douyin.api_v1_douyin_app_v3_fetch__music__hot__search__list \
|
|
225
|
+
--input '{"method":"GET","params":{}}'
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Common Workflows
|
|
229
|
+
|
|
230
|
+
### Track Douyin trending
|
|
231
|
+
|
|
232
|
+
1. Hot search: `douyin...fetch__hot__search__list` → top 50 trending topics
|
|
233
|
+
2. Brand hot search: `douyin...fetch__brand__hot__search__list` → brand trending
|
|
234
|
+
3. Get video details for a trending topic
|
|
235
|
+
|
|
236
|
+
### Research a Douyin creator
|
|
237
|
+
|
|
238
|
+
1. Get profile: `douyin...handler__user__profile` with `sec_user_id` → user info
|
|
239
|
+
2. Get videos: `douyin...fetch__user__post__videos` → browse recent posts
|
|
240
|
+
3. Get stats: `douyin...fetch__video__statistics` → batch check engagement metrics
|
|
241
|
+
|
|
242
|
+
### Analyze a Douyin video
|
|
243
|
+
|
|
244
|
+
1. Get video: `douyin...fetch__one__video` with `aweme_id` → full video data
|
|
245
|
+
2. Get stats: `douyin...fetch__video__statistics` → play count, likes, downloads, shares
|
|
246
|
+
3. Read comments: `douyin...fetch__video__comments` → top comments
|
|
247
|
+
4. Get replies: `douyin...fetch__video__comment__replies` → comment threads
|
|
248
|
+
|
|
249
|
+
### Browse a video series
|
|
250
|
+
|
|
251
|
+
1. Get series: `douyin...fetch__series__detail` or `douyin...fetch__video__mix__detail`
|
|
252
|
+
2. List videos: `douyin...fetch__series__video__list` or `douyin...fetch__video__mix__post__list`
|
|
253
|
+
|
|
254
|
+
## Pagination Patterns
|
|
255
|
+
|
|
256
|
+
| Pattern | Endpoints | How to use |
|
|
257
|
+
|---------|-----------|------------|
|
|
258
|
+
| `max_cursor` | user videos, liked videos | Pass `max_cursor` from previous response |
|
|
259
|
+
| `cursor` | comments, hashtag videos, mix post list | Pass `cursor` from previous response |
|
|
260
|
+
| `max_time` | fans list | Pass `max_time` from previous response |
|
|
261
|
+
|
|
262
|
+
## API Reference
|
|
263
|
+
|
|
264
|
+
| API (prefix: `douyin.api_v1_douyin_app_v3_`) | Description | Key Params |
|
|
265
|
+
|---|---|---|
|
|
266
|
+
| `handler__user__profile` | Get user profile | `sec_user_id` |
|
|
267
|
+
| `fetch__user__post__videos` | User's videos | `sec_user_id`, `count`, `max_cursor` |
|
|
268
|
+
| `fetch__user__like__videos` | User's liked videos | `sec_user_id`, `counts`, `max_cursor` |
|
|
269
|
+
| `fetch__user__fans__list` | User's fans | `sec_user_id`, `count`, `max_time` |
|
|
270
|
+
| `fetch__user__series__list` | User's series | `sec_user_id` |
|
|
271
|
+
| `fetch__one__video` | Single video | `aweme_id` |
|
|
272
|
+
| `fetch__one__video__v2` | Single video V2 | `aweme_id` |
|
|
273
|
+
| `fetch__one__video__v3` | Single video V3 (no copyright restrictions) | `aweme_id` |
|
|
274
|
+
| `fetch__one__video__by__share__url` | Video by share URL | `share_url` |
|
|
275
|
+
| `fetch__multi__video` | Batch get videos | `aweme_ids` |
|
|
276
|
+
| `fetch__video__statistics` | Video stats (batch) | `aweme_ids` |
|
|
277
|
+
| `fetch__video__high__quality__play__url` | High quality play URL | `aweme_id` |
|
|
278
|
+
| `fetch__video__comments` | Video comments | `aweme_id`, `count`, `cursor` |
|
|
279
|
+
| `fetch__video__comment__replies` | Comment replies | `item_id`, `comment_id`, `count`, `cursor` |
|
|
280
|
+
| `fetch__video__mix__detail` | Video mix detail | `mix_id` |
|
|
281
|
+
| `fetch__video__mix__post__list` | Video mix posts | `mix_id`, `count`, `cursor` |
|
|
282
|
+
| `fetch__series__detail` | Series detail | `series_id` |
|
|
283
|
+
| `fetch__series__video__list` | Series videos | `series_id` |
|
|
284
|
+
| `fetch__hot__search__list` | Hot search list | `board_type`, `board_sub_type` |
|
|
285
|
+
| `fetch__brand__hot__search__list` | Brand hot search | — |
|
|
286
|
+
| `fetch__live__hot__search__list` | Live hot search | — |
|
|
287
|
+
| `fetch__hashtag__detail` | Hashtag details | `ch_id` (integer) |
|
|
288
|
+
| `fetch__hashtag__video__list` | Hashtag videos | `ch_id`, `count`, `cursor`, `sort_type` |
|
|
289
|
+
| `fetch__music__detail` | Music details | `music_id` |
|
|
290
|
+
| `fetch__music__video__list` | Music videos | `music_id` |
|
|
291
|
+
| `fetch__music__hot__search__list` | Music hot search | — |
|
|
292
|
+
|
|
293
|
+
## Error Handling
|
|
294
|
+
|
|
295
|
+
- **Missing sec_user_id** → Douyin requires `sec_user_id` for most user-related endpoints; obtain it through other channels
|
|
296
|
+
- **Empty results** → Check that `aweme_id`, `ch_id`, `mix_id`, or `music_id` is valid
|
|
297
|
+
- **Pagination exhausted** → When `has_more` is `0` or `false`, no more pages available
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Google Search Guide
|
|
2
|
+
|
|
3
|
+
Complete guide for web search operations via xAPI — general search, realtime search, news, images, videos, scholar, maps, places, and shopping.
|
|
4
|
+
|
|
5
|
+
All search endpoints are capability-type actions under the `web.search` namespace. Parameters are passed directly (no `"method"` or `"params"` wrapper needed).
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- [Common parameters](#common-parameters)
|
|
10
|
+
- [Web search](#web-search)
|
|
11
|
+
- [News, image, video, and scholar search](#news-search)
|
|
12
|
+
- [Maps and places](#maps-search)
|
|
13
|
+
- [Shopping search](#shopping-search)
|
|
14
|
+
- [Common workflows](#common-workflows)
|
|
15
|
+
- [Localization tips](#localization-tips)
|
|
16
|
+
- [API reference](#api-reference)
|
|
17
|
+
|
|
18
|
+
## Common Parameters
|
|
19
|
+
|
|
20
|
+
All search capabilities accept `q`, `gl`, `hl`, and `page`. Most also accept `autocorrect`; `web.search.realtime` does not expose it and deliberately disables autocorrection. Run `get` before relying on optional parameters.
|
|
21
|
+
|
|
22
|
+
| Parameter | Type | Default | Description |
|
|
23
|
+
|-----------|------|---------|-------------|
|
|
24
|
+
| `q` | string | **(required)** | Search query |
|
|
25
|
+
| `gl` | string | `"us"` | Country code (e.g. `us`, `cn`, `jp`, `de`) |
|
|
26
|
+
| `hl` | string | `"en"` | Language code (e.g. `en`, `zh`, `ja`, `de`) |
|
|
27
|
+
| `page` | number | `1` | Page number for pagination |
|
|
28
|
+
| `autocorrect` | boolean | `true` | Supported by every search capability except `web.search.realtime` |
|
|
29
|
+
|
|
30
|
+
## Web Search
|
|
31
|
+
|
|
32
|
+
### General web search
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npx xapi-to call web.search --input '{"q":"OpenAI GPT-5","num":10}'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Additional parameters:
|
|
39
|
+
- `num` — number of results to return (default 10)
|
|
40
|
+
- `location` — location name for localized results
|
|
41
|
+
|
|
42
|
+
Returns `data.organic[]` with `title`, `link`, `snippet`, and `position`. The declared response also includes optional `data.knowledgeGraph` and `data.relatedSearches[]`.
|
|
43
|
+
|
|
44
|
+
### Realtime web search
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx xapi-to call web.search.realtime --input '{"q":"breaking news","timeRange":"day","num":10}'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For finding the latest content with time-based filtering.
|
|
51
|
+
|
|
52
|
+
Additional parameters:
|
|
53
|
+
- `timeRange` — time filter: `"hour"`, `"day"` (default), `"week"`, `"month"`, `"year"`
|
|
54
|
+
- `num` — number of results (default 10)
|
|
55
|
+
- `location` — location for localized results
|
|
56
|
+
|
|
57
|
+
Returns `data.organic[]` with fields: `title`, `link`, `snippet`, `position`, `date`.
|
|
58
|
+
|
|
59
|
+
## News Search
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx xapi-to call web.search.news --input '{"q":"AI regulation"}'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Search Google News for articles.
|
|
66
|
+
|
|
67
|
+
Additional parameters:
|
|
68
|
+
- `tbs` — date range filter: `"qdr:h"` (past hour), `"qdr:d"` (past 24h), `"qdr:w"` (past week), `"qdr:m"` (past month), `"qdr:y"` (past year)
|
|
69
|
+
|
|
70
|
+
Returns `data.news[]` with fields: `title`, `link`, `snippet`, `date`, `source`, `imageUrl`.
|
|
71
|
+
|
|
72
|
+
## Image Search
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx xapi-to call web.search.image --input '{"q":"aurora borealis"}'
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Search Google Images.
|
|
79
|
+
|
|
80
|
+
Additional parameters:
|
|
81
|
+
- `tbs` — date range filter (same values as news)
|
|
82
|
+
|
|
83
|
+
Returns `data.images[]` with fields: `title`, `imageUrl`, `imageWidth`, `imageHeight`, `thumbnailUrl`, `source`, `domain`, `link`.
|
|
84
|
+
|
|
85
|
+
## Video Search
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npx xapi-to call web.search.video --input '{"q":"machine learning tutorial"}'
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Search Google Videos (primarily YouTube results).
|
|
92
|
+
|
|
93
|
+
Additional parameters:
|
|
94
|
+
- `tbs` — date range filter (same values as news)
|
|
95
|
+
|
|
96
|
+
Returns `data.videos[]` with declared fields `title`, `link`, `snippet`, `channel`, `date`, and `duration`.
|
|
97
|
+
|
|
98
|
+
## Scholar Search
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npx xapi-to call web.search.scholar --input '{"q":"transformer architecture attention"}'
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Search Google Scholar for academic papers and citations.
|
|
105
|
+
|
|
106
|
+
Returns `data.organic[]` with declared fields `title`, `link`, `snippet`, `publicationInfo`, `citedBy`, and `year`.
|
|
107
|
+
|
|
108
|
+
## Maps Search
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npx xapi-to call web.search.maps --input '{"q":"coffee shop near Times Square"}'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Search Google Maps for locations and businesses.
|
|
115
|
+
|
|
116
|
+
Additional parameters:
|
|
117
|
+
- `ll` — latitude/longitude coordinates to center the search (e.g. `"@40.7455096,-74.0083012,14z"`)
|
|
118
|
+
|
|
119
|
+
Returns `data.places[]` with declared fields `title`, `address`, `latitude`, `longitude`, `rating`, `ratingCount`, and `category`.
|
|
120
|
+
|
|
121
|
+
## Places Search
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npx xapi-to call web.search.places --input '{"q":"best ramen in Tokyo","gl":"jp"}'
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Search for businesses and places with richer contact details. Use this capability when phone number or website is important.
|
|
128
|
+
|
|
129
|
+
Additional parameters:
|
|
130
|
+
- `location` — location name to scope the search (e.g. `"San Francisco, California, United States"`)
|
|
131
|
+
- `ll` — latitude/longitude coordinates (e.g. `"@37.7749295,-122.4194155,14z"`)
|
|
132
|
+
|
|
133
|
+
Returns `data.places[]` with declared fields `title`, `address`, `latitude`, `longitude`, `rating`, `ratingCount`, `category`, `phoneNumber`, and `website`.
|
|
134
|
+
|
|
135
|
+
## Shopping Search
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
npx xapi-to call web.search.shopping --input '{"q":"mechanical keyboard"}'
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Search Google Shopping for products and prices.
|
|
142
|
+
|
|
143
|
+
Additional parameters:
|
|
144
|
+
- `tbs` — date range filter
|
|
145
|
+
- `location` — location affecting prices and availability
|
|
146
|
+
|
|
147
|
+
Returns `data.shopping[]` with declared fields `title`, `source`, `link`, `price`, `rating`, `ratingCount`, and `imageUrl`.
|
|
148
|
+
|
|
149
|
+
The upstream provider can return additional fields that are not part of the capability's declared schema. Treat them as opportunistic: inspect the current `get` output and actual response before depending on them.
|
|
150
|
+
|
|
151
|
+
## Common Workflows
|
|
152
|
+
|
|
153
|
+
### Research a topic
|
|
154
|
+
|
|
155
|
+
1. Web search: `web.search` → get authoritative sources
|
|
156
|
+
2. News search: `web.search.news` → get latest developments
|
|
157
|
+
3. Scholar search: `web.search.scholar` → find academic papers
|
|
158
|
+
|
|
159
|
+
### Monitor breaking news
|
|
160
|
+
|
|
161
|
+
1. Realtime search: `web.search.realtime` with `timeRange: "hour"` → latest content
|
|
162
|
+
2. News search: `web.search.news` with `tbs: "qdr:h"` → latest news articles
|
|
163
|
+
|
|
164
|
+
### Find a local business
|
|
165
|
+
|
|
166
|
+
1. Maps search: `web.search.maps` with `ll` coordinates → find nearby listings and coordinates
|
|
167
|
+
2. Places search: `web.search.places` → add phone numbers and websites when the upstream provides them
|
|
168
|
+
|
|
169
|
+
### Product research
|
|
170
|
+
|
|
171
|
+
1. Shopping search: `web.search.shopping` → compare prices and ratings
|
|
172
|
+
2. Web search: `web.search` with `"<product> review"` → find reviews
|
|
173
|
+
|
|
174
|
+
## Localization Tips
|
|
175
|
+
|
|
176
|
+
- Set `gl` (country) and `hl` (language) together for best results:
|
|
177
|
+
- Chinese results: `"gl":"cn","hl":"zh"`
|
|
178
|
+
- Japanese results: `"gl":"jp","hl":"ja"`
|
|
179
|
+
- German results: `"gl":"de","hl":"de"`
|
|
180
|
+
- Use `location` (for `web.search`, `web.search.realtime`, `web.search.places`, `web.search.shopping`) for city-level localization
|
|
181
|
+
|
|
182
|
+
## API Reference
|
|
183
|
+
|
|
184
|
+
| Capability | Description | Result Field | Key Result Fields |
|
|
185
|
+
|------------|-------------|--------------|-------------------|
|
|
186
|
+
| `web.search` | General web search | `organic[]` | `title`, `link`, `snippet`, `position` |
|
|
187
|
+
| `web.search.realtime` | Realtime web search | `organic[]` | `title`, `link`, `snippet`, `date` |
|
|
188
|
+
| `web.search.news` | News articles | `news[]` | `title`, `link`, `source`, `date` |
|
|
189
|
+
| `web.search.image` | Image search | `images[]` | `title`, `imageUrl`, `imageWidth`, `imageHeight` |
|
|
190
|
+
| `web.search.video` | Video search | `videos[]` | `title`, `link`, `channel`, `duration` |
|
|
191
|
+
| `web.search.scholar` | Academic papers | `organic[]` | `title`, `link`, `citedBy`, `year` |
|
|
192
|
+
| `web.search.maps` | Map locations | `places[]` | `title`, `address`, `latitude`, `longitude`, `category` |
|
|
193
|
+
| `web.search.places` | Detailed business listings | `places[]` | `title`, `address`, `category`, `phoneNumber`, `website` |
|
|
194
|
+
| `web.search.shopping` | Product search | `shopping[]` | `title`, `price`, `source`, `rating`, `imageUrl` |
|