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,1452 @@
|
|
|
1
|
+
# Generated - do not edit. Regenerate with: pnpm generate
|
|
2
|
+
"""Generated namespace module for the youtube 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
|
+
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 YoutubeChannelInput(TypedDict, total=False):
|
|
25
|
+
"""Input for YouTube Channel."""
|
|
26
|
+
|
|
27
|
+
channelId: NotRequired[str]
|
|
28
|
+
"""YouTube channel ID (UC...)."""
|
|
29
|
+
handle: NotRequired[str]
|
|
30
|
+
"""YouTube channel handle."""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class YoutubeChannelCommunityPostsInput(TypedDict, total=False):
|
|
34
|
+
"""Input for YouTube Channel Community Posts."""
|
|
35
|
+
|
|
36
|
+
channelId: NotRequired[str]
|
|
37
|
+
"""YouTube channel ID."""
|
|
38
|
+
cursor: NotRequired[str]
|
|
39
|
+
"""Continuation token from a previous response for pagination."""
|
|
40
|
+
handle: NotRequired[str]
|
|
41
|
+
"""YouTube channel handle."""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class YoutubeChannelLivesInput(TypedDict, total=False):
|
|
45
|
+
"""Input for YouTube Channel Live Streams."""
|
|
46
|
+
|
|
47
|
+
channelId: NotRequired[str]
|
|
48
|
+
"""YouTube channel ID."""
|
|
49
|
+
cursor: NotRequired[str]
|
|
50
|
+
"""Continuation token from a previous response for pagination."""
|
|
51
|
+
handle: NotRequired[str]
|
|
52
|
+
"""YouTube channel handle."""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class YoutubeChannelPlaylistsInput(TypedDict, total=False):
|
|
56
|
+
"""Input for YouTube Channel Playlists."""
|
|
57
|
+
|
|
58
|
+
channelId: NotRequired[str]
|
|
59
|
+
"""YouTube channel ID."""
|
|
60
|
+
cursor: NotRequired[str]
|
|
61
|
+
"""Continuation token from a previous response for pagination."""
|
|
62
|
+
handle: NotRequired[str]
|
|
63
|
+
"""YouTube channel handle."""
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class YoutubeChannelShortsInput(TypedDict, total=False):
|
|
67
|
+
"""Input for YouTube Channel Shorts."""
|
|
68
|
+
|
|
69
|
+
channelId: NotRequired[str]
|
|
70
|
+
"""YouTube channel ID."""
|
|
71
|
+
cursor: NotRequired[str]
|
|
72
|
+
"""Continuation token from a previous response for pagination."""
|
|
73
|
+
handle: NotRequired[str]
|
|
74
|
+
"""YouTube channel handle."""
|
|
75
|
+
sort: NotRequired[Literal["newest", "popular"]]
|
|
76
|
+
"""Sort order."""
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class YoutubeChannelVideosInput(TypedDict, total=False):
|
|
80
|
+
"""Input for YouTube Channel Videos."""
|
|
81
|
+
|
|
82
|
+
channelId: NotRequired[str]
|
|
83
|
+
"""YouTube channel ID."""
|
|
84
|
+
cursor: NotRequired[str]
|
|
85
|
+
"""Continuation token from a previous response for pagination."""
|
|
86
|
+
handle: NotRequired[str]
|
|
87
|
+
"""YouTube channel handle."""
|
|
88
|
+
sort: NotRequired[Literal["latest", "popular"]]
|
|
89
|
+
"""Sort order."""
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class YoutubeCommentRepliesInput(TypedDict, total=False):
|
|
93
|
+
"""Input for YouTube Comment Replies."""
|
|
94
|
+
|
|
95
|
+
continuationToken: Required[str]
|
|
96
|
+
"""Replies continuation token from the comments endpoint, or the continuationToken from a previous replies response for further pagination."""
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class YoutubeCommunityPostInput(TypedDict, total=False):
|
|
100
|
+
"""Input for YouTube Community Post."""
|
|
101
|
+
|
|
102
|
+
url: Required[str]
|
|
103
|
+
"""URL of the YouTube community post."""
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class YoutubePlaylistInput(TypedDict, total=False):
|
|
107
|
+
"""Input for YouTube Playlist."""
|
|
108
|
+
|
|
109
|
+
playlistId: Required[str]
|
|
110
|
+
"""The playlist ID - the "list" parameter in a playlist URL (e.g. "PLu0W_9lII9ahIappRPN0MCAgtOu3lQjQi")."""
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class YoutubeSearchInput(TypedDict, total=False):
|
|
114
|
+
"""Input for YouTube Search."""
|
|
115
|
+
|
|
116
|
+
cursor: NotRequired[str]
|
|
117
|
+
"""Continuation token from a previous response for pagination."""
|
|
118
|
+
query: Required[str]
|
|
119
|
+
"""The YouTube search query."""
|
|
120
|
+
sortBy: NotRequired[Literal["relevance", "popular"]]
|
|
121
|
+
"""Sort order: "relevance" (default) or "popular" (most-viewed). Default: relevance."""
|
|
122
|
+
uploadDate: NotRequired[Literal["today", "this_week", "this_month", "this_year"]]
|
|
123
|
+
"""Filter by upload recency. Omit for any time."""
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class YoutubeSearchHashtagInput(TypedDict, total=False):
|
|
127
|
+
"""Input for YouTube Hashtag Search."""
|
|
128
|
+
|
|
129
|
+
cursor: NotRequired[str]
|
|
130
|
+
"""Continuation token from a previous response for pagination."""
|
|
131
|
+
hashtag: Required[str]
|
|
132
|
+
"""Hashtag to search for (without the leading #)."""
|
|
133
|
+
type: NotRequired[Literal["all", "shorts"]]
|
|
134
|
+
"""Content filter."""
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class YoutubeTrendingShortsInput(TypedDict, total=False):
|
|
138
|
+
"""Input for YouTube Trending Shorts."""
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class YoutubeVideoInput(TypedDict, total=False):
|
|
142
|
+
"""Input for YouTube Video."""
|
|
143
|
+
|
|
144
|
+
id: NotRequired[str]
|
|
145
|
+
"""YouTube video ID."""
|
|
146
|
+
url: NotRequired[str]
|
|
147
|
+
"""Full YouTube video URL."""
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class YoutubeVideoCommentsInput(TypedDict, total=False):
|
|
151
|
+
"""Input for YouTube Video Comments."""
|
|
152
|
+
|
|
153
|
+
cursor: NotRequired[str]
|
|
154
|
+
"""Continuation token from a previous response for pagination."""
|
|
155
|
+
order: NotRequired[str]
|
|
156
|
+
"""Comment order (e.g. top, newest)."""
|
|
157
|
+
url: Required[str]
|
|
158
|
+
"""Full YouTube video URL."""
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class YoutubeVideoSponsorsInput(TypedDict, total=False):
|
|
162
|
+
"""Input for YouTube Video Sponsors."""
|
|
163
|
+
|
|
164
|
+
language: NotRequired[str]
|
|
165
|
+
"""2-letter language code for transcript lookup (e.g. en, es, fr)."""
|
|
166
|
+
url: Required[str]
|
|
167
|
+
"""YouTube video or Short URL."""
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class YoutubeVideoTranscriptInput(TypedDict, total=False):
|
|
171
|
+
"""Input for YouTube Video Transcript."""
|
|
172
|
+
|
|
173
|
+
id: NotRequired[str]
|
|
174
|
+
"""YouTube video ID."""
|
|
175
|
+
url: NotRequired[str]
|
|
176
|
+
"""Full YouTube video URL."""
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class YoutubeChannelData(BaseModel):
|
|
180
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
181
|
+
|
|
182
|
+
avatar_url: str = Field(alias="avatarUrl")
|
|
183
|
+
channel_id: str = Field(alias="channelId")
|
|
184
|
+
description: str
|
|
185
|
+
subscribers: int
|
|
186
|
+
title: str
|
|
187
|
+
videos: int
|
|
188
|
+
views: int
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
class YoutubeChannelCommunityPostsData(BaseModel):
|
|
192
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
193
|
+
|
|
194
|
+
next_cursor: str = Field(alias="nextCursor")
|
|
195
|
+
posts: list[YoutubeChannelCommunityPostsPost]
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class YoutubeChannelCommunityPostsPost(BaseModel):
|
|
199
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
200
|
+
|
|
201
|
+
content: str
|
|
202
|
+
id: str
|
|
203
|
+
image: str
|
|
204
|
+
like_count: int = Field(alias="likeCount")
|
|
205
|
+
published_time: str = Field(alias="publishedTime")
|
|
206
|
+
url: str
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
class YoutubeChannelLivesData(BaseModel):
|
|
210
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
211
|
+
|
|
212
|
+
lives: list[YoutubeChannelLivesLive]
|
|
213
|
+
next_cursor: str = Field(alias="nextCursor")
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
class YoutubeChannelLivesLive(BaseModel):
|
|
217
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
218
|
+
|
|
219
|
+
id: str
|
|
220
|
+
length_text: str = Field(alias="lengthText")
|
|
221
|
+
published_time: str = Field(alias="publishedTime")
|
|
222
|
+
title: str
|
|
223
|
+
url: str
|
|
224
|
+
views: int
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
class YoutubeChannelPlaylistsData(BaseModel):
|
|
228
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
229
|
+
|
|
230
|
+
next_cursor: str = Field(alias="nextCursor")
|
|
231
|
+
playlists: list[YoutubeChannelPlaylistsPlaylist]
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class YoutubeChannelPlaylistsPlaylist(BaseModel):
|
|
235
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
236
|
+
|
|
237
|
+
id: str
|
|
238
|
+
playlist_url: str = Field(alias="playlistUrl")
|
|
239
|
+
thumbnail: str
|
|
240
|
+
title: str
|
|
241
|
+
video_count: int = Field(alias="videoCount")
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
class YoutubeChannelShortsData(BaseModel):
|
|
245
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
246
|
+
|
|
247
|
+
next_cursor: str = Field(alias="nextCursor")
|
|
248
|
+
shorts: list[YoutubeChannelShortsShort]
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
class YoutubeChannelShortsShort(BaseModel):
|
|
252
|
+
model_config = ConfigDict(extra="allow")
|
|
253
|
+
|
|
254
|
+
duration: str
|
|
255
|
+
id: str
|
|
256
|
+
likes: int
|
|
257
|
+
title: str
|
|
258
|
+
url: str
|
|
259
|
+
views: int
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class YoutubeChannelVideosData(BaseModel):
|
|
263
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
264
|
+
|
|
265
|
+
next_cursor: str = Field(alias="nextCursor")
|
|
266
|
+
videos: list[YoutubeChannelVideosVideo]
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
class YoutubeChannelVideosVideo(BaseModel):
|
|
270
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
271
|
+
|
|
272
|
+
id: str
|
|
273
|
+
length_text: str = Field(alias="lengthText")
|
|
274
|
+
published_time: str = Field(alias="publishedTime")
|
|
275
|
+
title: str
|
|
276
|
+
url: str
|
|
277
|
+
views: int
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
class YoutubeCommentRepliesData(BaseModel):
|
|
281
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
282
|
+
|
|
283
|
+
comments: list[YoutubeCommentRepliesComment]
|
|
284
|
+
next_cursor: str = Field(alias="nextCursor")
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class YoutubeCommentRepliesComment(BaseModel):
|
|
288
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
289
|
+
|
|
290
|
+
author_name: str = Field(alias="authorName")
|
|
291
|
+
content: str
|
|
292
|
+
id: str
|
|
293
|
+
likes: int
|
|
294
|
+
published_time: str = Field(alias="publishedTime")
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
class YoutubeCommunityPostData(BaseModel):
|
|
298
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
299
|
+
|
|
300
|
+
channel_handle: str = Field(alias="channelHandle")
|
|
301
|
+
channel_title: str = Field(alias="channelTitle")
|
|
302
|
+
content: str
|
|
303
|
+
id: str
|
|
304
|
+
published_time: str = Field(alias="publishedTime")
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
class YoutubePlaylistData(BaseModel):
|
|
308
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
309
|
+
|
|
310
|
+
owner: str
|
|
311
|
+
title: str
|
|
312
|
+
total_videos: int = Field(alias="totalVideos")
|
|
313
|
+
videos: list[YoutubePlaylistVideo]
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
class YoutubePlaylistVideo(BaseModel):
|
|
317
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
318
|
+
|
|
319
|
+
channel: str
|
|
320
|
+
id: str
|
|
321
|
+
length_seconds: int = Field(alias="lengthSeconds")
|
|
322
|
+
length_text: str = Field(alias="lengthText")
|
|
323
|
+
thumbnail: str
|
|
324
|
+
title: str
|
|
325
|
+
url: str
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
class YoutubeSearchData(BaseModel):
|
|
329
|
+
videos: list[YoutubeSearchVideo]
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
class YoutubeSearchVideo(BaseModel):
|
|
333
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
334
|
+
|
|
335
|
+
channel: str
|
|
336
|
+
id: str
|
|
337
|
+
length_text: str = Field(alias="lengthText")
|
|
338
|
+
published_time: str = Field(alias="publishedTime")
|
|
339
|
+
title: str
|
|
340
|
+
url: str
|
|
341
|
+
views: int
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
class YoutubeSearchHashtagData(BaseModel):
|
|
345
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
346
|
+
|
|
347
|
+
next_cursor: str = Field(alias="nextCursor")
|
|
348
|
+
videos: list[YoutubeSearchHashtagVideo]
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
class YoutubeSearchHashtagVideo(BaseModel):
|
|
352
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
353
|
+
|
|
354
|
+
channel_title: str = Field(alias="channelTitle")
|
|
355
|
+
id: str
|
|
356
|
+
length_text: str = Field(alias="lengthText")
|
|
357
|
+
published_time: str = Field(alias="publishedTime")
|
|
358
|
+
title: str
|
|
359
|
+
url: str
|
|
360
|
+
views: int
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
class YoutubeTrendingShortsData(BaseModel):
|
|
364
|
+
shorts: list[YoutubeTrendingShortsShort]
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
class YoutubeTrendingShortsShort(BaseModel):
|
|
368
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
369
|
+
|
|
370
|
+
channel_title: str = Field(alias="channelTitle")
|
|
371
|
+
duration: str
|
|
372
|
+
id: str
|
|
373
|
+
likes: int
|
|
374
|
+
title: str
|
|
375
|
+
url: str
|
|
376
|
+
views: int
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
class YoutubeVideoData(BaseModel):
|
|
380
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
381
|
+
|
|
382
|
+
channel: str
|
|
383
|
+
comments: int
|
|
384
|
+
duration_ms: int = Field(alias="durationMs")
|
|
385
|
+
id: str
|
|
386
|
+
likes: int
|
|
387
|
+
published_at: str = Field(alias="publishedAt")
|
|
388
|
+
title: str
|
|
389
|
+
views: int
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
class YoutubeVideoCommentsData(BaseModel):
|
|
393
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
394
|
+
|
|
395
|
+
comments: list[YoutubeVideoCommentsComment]
|
|
396
|
+
next_cursor: str = Field(alias="nextCursor")
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
class YoutubeVideoCommentsComment(BaseModel):
|
|
400
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
401
|
+
|
|
402
|
+
author: str
|
|
403
|
+
id: str
|
|
404
|
+
likes: int
|
|
405
|
+
published_time: str = Field(alias="publishedTime")
|
|
406
|
+
replies: int
|
|
407
|
+
text: str
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
class YoutubeVideoSponsorsData(BaseModel):
|
|
411
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
412
|
+
|
|
413
|
+
detection_status: str = Field(alias="detectionStatus")
|
|
414
|
+
is_paid_promotion: bool = Field(alias="isPaidPromotion")
|
|
415
|
+
suspected_sponsors: list[YoutubeVideoSponsorsSuspectedSponsor] = Field(
|
|
416
|
+
alias="suspectedSponsors"
|
|
417
|
+
)
|
|
418
|
+
title: str
|
|
419
|
+
video_id: str = Field(alias="videoId")
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
class YoutubeVideoSponsorsSuspectedSponsor(BaseModel):
|
|
423
|
+
model_config = ConfigDict(extra="allow")
|
|
424
|
+
|
|
425
|
+
confidence: str
|
|
426
|
+
name: str
|
|
427
|
+
website: str
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
class YoutubeVideoTranscriptData(BaseModel):
|
|
431
|
+
model_config = ConfigDict(extra="allow")
|
|
432
|
+
|
|
433
|
+
language: str
|
|
434
|
+
transcript: str
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
class YoutubeNamespace:
|
|
438
|
+
"""Typed methods for this platform. Attached lazily to the client."""
|
|
439
|
+
|
|
440
|
+
def __init__(self, client: "AnyAPI") -> None:
|
|
441
|
+
self._client = client
|
|
442
|
+
|
|
443
|
+
def channel(
|
|
444
|
+
self,
|
|
445
|
+
*,
|
|
446
|
+
options: RequestOptions | None = None,
|
|
447
|
+
**input: Unpack[YoutubeChannelInput],
|
|
448
|
+
) -> RunResult[YoutubeChannelData]:
|
|
449
|
+
"""YouTube Channel
|
|
450
|
+
|
|
451
|
+
Fetch a YouTube channel's stats (subscribers, video count, total views,
|
|
452
|
+
description) by handle or channel ID, normalized across providers.
|
|
453
|
+
|
|
454
|
+
Price: $0.002 per request.
|
|
455
|
+
|
|
456
|
+
Example:
|
|
457
|
+
res = client.youtube.channel(handle="@mkbhd")
|
|
458
|
+
"""
|
|
459
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
460
|
+
"youtube.channel", dict(input), options
|
|
461
|
+
)
|
|
462
|
+
return RunResult[YoutubeChannelData].model_validate(raw)
|
|
463
|
+
|
|
464
|
+
def channel_community_posts(
|
|
465
|
+
self,
|
|
466
|
+
*,
|
|
467
|
+
options: RequestOptions | None = None,
|
|
468
|
+
**input: Unpack[YoutubeChannelCommunityPostsInput],
|
|
469
|
+
) -> RunResult[YoutubeChannelCommunityPostsData]:
|
|
470
|
+
"""YouTube Channel Community Posts
|
|
471
|
+
|
|
472
|
+
List a YouTube channel's community posts by handle or channel ID with cursor
|
|
473
|
+
pagination (text, likes, image, publish time), normalized across providers.
|
|
474
|
+
|
|
475
|
+
Price: $0.002 per request.
|
|
476
|
+
|
|
477
|
+
Example:
|
|
478
|
+
res = client.youtube.channel_community_posts(handle="@MrBeast")
|
|
479
|
+
"""
|
|
480
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
481
|
+
"youtube.channel_community_posts", dict(input), options
|
|
482
|
+
)
|
|
483
|
+
return RunResult[YoutubeChannelCommunityPostsData].model_validate(raw)
|
|
484
|
+
|
|
485
|
+
def iter_channel_community_posts(
|
|
486
|
+
self,
|
|
487
|
+
*,
|
|
488
|
+
options: RequestOptions | None = None,
|
|
489
|
+
**input: Unpack[YoutubeChannelCommunityPostsInput],
|
|
490
|
+
) -> Paginator[YoutubeChannelCommunityPostsPost, YoutubeChannelCommunityPostsData]:
|
|
491
|
+
"""Iterate YouTube Channel Community Posts results, following pagination cursors.
|
|
492
|
+
|
|
493
|
+
Yields validated `YoutubeChannelCommunityPostsPost` items from the `posts` field of
|
|
494
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
495
|
+
`RunResult` pages.
|
|
496
|
+
"""
|
|
497
|
+
return paginate(
|
|
498
|
+
self._client,
|
|
499
|
+
"youtube.channel_community_posts",
|
|
500
|
+
dict(input),
|
|
501
|
+
"posts",
|
|
502
|
+
item_model=YoutubeChannelCommunityPostsPost,
|
|
503
|
+
data_model=YoutubeChannelCommunityPostsData,
|
|
504
|
+
bare=False,
|
|
505
|
+
options=options,
|
|
506
|
+
)
|
|
507
|
+
|
|
508
|
+
def channel_lives(
|
|
509
|
+
self,
|
|
510
|
+
*,
|
|
511
|
+
options: RequestOptions | None = None,
|
|
512
|
+
**input: Unpack[YoutubeChannelLivesInput],
|
|
513
|
+
) -> RunResult[YoutubeChannelLivesData]:
|
|
514
|
+
"""YouTube Channel Live Streams
|
|
515
|
+
|
|
516
|
+
List a YouTube channel's live and past-live streams by handle or channel ID
|
|
517
|
+
with cursor pagination (title, views, length, publish time), normalized
|
|
518
|
+
across providers.
|
|
519
|
+
|
|
520
|
+
Price: $0.002 per request.
|
|
521
|
+
|
|
522
|
+
Example:
|
|
523
|
+
res = client.youtube.channel_lives(handle="@IShowSpeed")
|
|
524
|
+
"""
|
|
525
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
526
|
+
"youtube.channel_lives", dict(input), options
|
|
527
|
+
)
|
|
528
|
+
return RunResult[YoutubeChannelLivesData].model_validate(raw)
|
|
529
|
+
|
|
530
|
+
def iter_channel_lives(
|
|
531
|
+
self,
|
|
532
|
+
*,
|
|
533
|
+
options: RequestOptions | None = None,
|
|
534
|
+
**input: Unpack[YoutubeChannelLivesInput],
|
|
535
|
+
) -> Paginator[YoutubeChannelLivesLive, YoutubeChannelLivesData]:
|
|
536
|
+
"""Iterate YouTube Channel Live Streams results, following pagination cursors.
|
|
537
|
+
|
|
538
|
+
Yields validated `YoutubeChannelLivesLive` items from the `lives` 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
|
+
"youtube.channel_lives",
|
|
545
|
+
dict(input),
|
|
546
|
+
"lives",
|
|
547
|
+
item_model=YoutubeChannelLivesLive,
|
|
548
|
+
data_model=YoutubeChannelLivesData,
|
|
549
|
+
bare=False,
|
|
550
|
+
options=options,
|
|
551
|
+
)
|
|
552
|
+
|
|
553
|
+
def channel_playlists(
|
|
554
|
+
self,
|
|
555
|
+
*,
|
|
556
|
+
options: RequestOptions | None = None,
|
|
557
|
+
**input: Unpack[YoutubeChannelPlaylistsInput],
|
|
558
|
+
) -> RunResult[YoutubeChannelPlaylistsData]:
|
|
559
|
+
"""YouTube Channel Playlists
|
|
560
|
+
|
|
561
|
+
List a YouTube channel's playlists by handle or channel ID with cursor
|
|
562
|
+
pagination (title, video count, thumbnail), normalized across providers.
|
|
563
|
+
|
|
564
|
+
Price: $0.002 per request.
|
|
565
|
+
|
|
566
|
+
Example:
|
|
567
|
+
res = client.youtube.channel_playlists(handle="@veritasium")
|
|
568
|
+
"""
|
|
569
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
570
|
+
"youtube.channel_playlists", dict(input), options
|
|
571
|
+
)
|
|
572
|
+
return RunResult[YoutubeChannelPlaylistsData].model_validate(raw)
|
|
573
|
+
|
|
574
|
+
def iter_channel_playlists(
|
|
575
|
+
self,
|
|
576
|
+
*,
|
|
577
|
+
options: RequestOptions | None = None,
|
|
578
|
+
**input: Unpack[YoutubeChannelPlaylistsInput],
|
|
579
|
+
) -> Paginator[YoutubeChannelPlaylistsPlaylist, YoutubeChannelPlaylistsData]:
|
|
580
|
+
"""Iterate YouTube Channel Playlists results, following pagination cursors.
|
|
581
|
+
|
|
582
|
+
Yields validated `YoutubeChannelPlaylistsPlaylist` items from the `playlists` field of
|
|
583
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
584
|
+
`RunResult` pages.
|
|
585
|
+
"""
|
|
586
|
+
return paginate(
|
|
587
|
+
self._client,
|
|
588
|
+
"youtube.channel_playlists",
|
|
589
|
+
dict(input),
|
|
590
|
+
"playlists",
|
|
591
|
+
item_model=YoutubeChannelPlaylistsPlaylist,
|
|
592
|
+
data_model=YoutubeChannelPlaylistsData,
|
|
593
|
+
bare=False,
|
|
594
|
+
options=options,
|
|
595
|
+
)
|
|
596
|
+
|
|
597
|
+
def channel_shorts(
|
|
598
|
+
self,
|
|
599
|
+
*,
|
|
600
|
+
options: RequestOptions | None = None,
|
|
601
|
+
**input: Unpack[YoutubeChannelShortsInput],
|
|
602
|
+
) -> RunResult[YoutubeChannelShortsData]:
|
|
603
|
+
"""YouTube Channel Shorts
|
|
604
|
+
|
|
605
|
+
List a YouTube channel's Shorts by handle or channel ID with cursor
|
|
606
|
+
pagination (title, views, likes, duration), normalized across providers.
|
|
607
|
+
|
|
608
|
+
Price: $0.002 per request.
|
|
609
|
+
|
|
610
|
+
Example:
|
|
611
|
+
res = client.youtube.channel_shorts(handle="@starterstory")
|
|
612
|
+
"""
|
|
613
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
614
|
+
"youtube.channel_shorts", dict(input), options
|
|
615
|
+
)
|
|
616
|
+
return RunResult[YoutubeChannelShortsData].model_validate(raw)
|
|
617
|
+
|
|
618
|
+
def iter_channel_shorts(
|
|
619
|
+
self,
|
|
620
|
+
*,
|
|
621
|
+
options: RequestOptions | None = None,
|
|
622
|
+
**input: Unpack[YoutubeChannelShortsInput],
|
|
623
|
+
) -> Paginator[YoutubeChannelShortsShort, YoutubeChannelShortsData]:
|
|
624
|
+
"""Iterate YouTube Channel Shorts results, following pagination cursors.
|
|
625
|
+
|
|
626
|
+
Yields validated `YoutubeChannelShortsShort` items from the `shorts` field of
|
|
627
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
628
|
+
`RunResult` pages.
|
|
629
|
+
"""
|
|
630
|
+
return paginate(
|
|
631
|
+
self._client,
|
|
632
|
+
"youtube.channel_shorts",
|
|
633
|
+
dict(input),
|
|
634
|
+
"shorts",
|
|
635
|
+
item_model=YoutubeChannelShortsShort,
|
|
636
|
+
data_model=YoutubeChannelShortsData,
|
|
637
|
+
bare=False,
|
|
638
|
+
options=options,
|
|
639
|
+
)
|
|
640
|
+
|
|
641
|
+
def channel_videos(
|
|
642
|
+
self,
|
|
643
|
+
*,
|
|
644
|
+
options: RequestOptions | None = None,
|
|
645
|
+
**input: Unpack[YoutubeChannelVideosInput],
|
|
646
|
+
) -> RunResult[YoutubeChannelVideosData]:
|
|
647
|
+
"""YouTube Channel Videos
|
|
648
|
+
|
|
649
|
+
List a YouTube channel's videos by handle or channel ID with cursor
|
|
650
|
+
pagination (title, views, length, publish time), normalized across
|
|
651
|
+
providers.
|
|
652
|
+
|
|
653
|
+
Price: $0.002 per request.
|
|
654
|
+
|
|
655
|
+
Example:
|
|
656
|
+
res = client.youtube.channel_videos(handle="@mkbhd")
|
|
657
|
+
"""
|
|
658
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
659
|
+
"youtube.channel_videos", dict(input), options
|
|
660
|
+
)
|
|
661
|
+
return RunResult[YoutubeChannelVideosData].model_validate(raw)
|
|
662
|
+
|
|
663
|
+
def iter_channel_videos(
|
|
664
|
+
self,
|
|
665
|
+
*,
|
|
666
|
+
options: RequestOptions | None = None,
|
|
667
|
+
**input: Unpack[YoutubeChannelVideosInput],
|
|
668
|
+
) -> Paginator[YoutubeChannelVideosVideo, YoutubeChannelVideosData]:
|
|
669
|
+
"""Iterate YouTube Channel Videos results, following pagination cursors.
|
|
670
|
+
|
|
671
|
+
Yields validated `YoutubeChannelVideosVideo` items from the `videos` field of
|
|
672
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
673
|
+
`RunResult` pages.
|
|
674
|
+
"""
|
|
675
|
+
return paginate(
|
|
676
|
+
self._client,
|
|
677
|
+
"youtube.channel_videos",
|
|
678
|
+
dict(input),
|
|
679
|
+
"videos",
|
|
680
|
+
item_model=YoutubeChannelVideosVideo,
|
|
681
|
+
data_model=YoutubeChannelVideosData,
|
|
682
|
+
bare=False,
|
|
683
|
+
options=options,
|
|
684
|
+
)
|
|
685
|
+
|
|
686
|
+
def comment_replies(
|
|
687
|
+
self,
|
|
688
|
+
*,
|
|
689
|
+
options: RequestOptions | None = None,
|
|
690
|
+
**input: Unpack[YoutubeCommentRepliesInput],
|
|
691
|
+
) -> RunResult[YoutubeCommentRepliesData]:
|
|
692
|
+
"""YouTube Comment Replies
|
|
693
|
+
|
|
694
|
+
List replies to a YouTube comment using a continuation token with cursor
|
|
695
|
+
pagination (text, author, likes, publish time), normalized across providers.
|
|
696
|
+
|
|
697
|
+
Price: $0.002 per request.
|
|
698
|
+
|
|
699
|
+
Example:
|
|
700
|
+
res = client.youtube.comment_replies(continuationToken="Eg0SC19fZm1EajBaSjFRGAYygwEaUBIaVWd3aXRjRk9fdmtpM0x4LUNfZDRBYUFCQWciAggAKhhVQ1g2T1EzRGtjc2JZTkU2SDh1UVF1VkEyC19fZm1EajBaSjFRQABICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dpdGNGT192a2kzTHgtQ19kNEFhQUJBZw==")
|
|
701
|
+
"""
|
|
702
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
703
|
+
"youtube.comment_replies", dict(input), options
|
|
704
|
+
)
|
|
705
|
+
return RunResult[YoutubeCommentRepliesData].model_validate(raw)
|
|
706
|
+
|
|
707
|
+
def community_post(
|
|
708
|
+
self,
|
|
709
|
+
*,
|
|
710
|
+
options: RequestOptions | None = None,
|
|
711
|
+
**input: Unpack[YoutubeCommunityPostInput],
|
|
712
|
+
) -> RunResult[YoutubeCommunityPostData]:
|
|
713
|
+
"""YouTube Community Post
|
|
714
|
+
|
|
715
|
+
Fetch a single YouTube community post by URL (text, images, channel, publish
|
|
716
|
+
time), normalized across providers.
|
|
717
|
+
|
|
718
|
+
Price: $0.002 per request.
|
|
719
|
+
|
|
720
|
+
Example:
|
|
721
|
+
res = client.youtube.community_post(url="https://www.youtube.com/post/Ugkx1LonSRBBUqASv-J8j9_FesxwlMAhT3_e")
|
|
722
|
+
"""
|
|
723
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
724
|
+
"youtube.community_post", dict(input), options
|
|
725
|
+
)
|
|
726
|
+
return RunResult[YoutubeCommunityPostData].model_validate(raw)
|
|
727
|
+
|
|
728
|
+
def playlist(
|
|
729
|
+
self,
|
|
730
|
+
*,
|
|
731
|
+
options: RequestOptions | None = None,
|
|
732
|
+
**input: Unpack[YoutubePlaylistInput],
|
|
733
|
+
) -> RunResult[YoutubePlaylistData]:
|
|
734
|
+
"""YouTube Playlist
|
|
735
|
+
|
|
736
|
+
List every video in a YouTube playlist - title, length, and channel per
|
|
737
|
+
video plus playlist owner and totals - normalized across providers with
|
|
738
|
+
transparent failover.
|
|
739
|
+
|
|
740
|
+
Price: $0.002 per request.
|
|
741
|
+
|
|
742
|
+
Example:
|
|
743
|
+
res = client.youtube.playlist(playlistId="PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj")
|
|
744
|
+
"""
|
|
745
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
746
|
+
"youtube.playlist", dict(input), options
|
|
747
|
+
)
|
|
748
|
+
return RunResult[YoutubePlaylistData].model_validate(raw)
|
|
749
|
+
|
|
750
|
+
def search(
|
|
751
|
+
self,
|
|
752
|
+
*,
|
|
753
|
+
options: RequestOptions | None = None,
|
|
754
|
+
**input: Unpack[YoutubeSearchInput],
|
|
755
|
+
) -> RunResult[YoutubeSearchData]:
|
|
756
|
+
"""YouTube Search
|
|
757
|
+
|
|
758
|
+
Search YouTube and get matching videos (title, channel, views, length,
|
|
759
|
+
publish time) as normalized JSON, across providers with transparent
|
|
760
|
+
failover.
|
|
761
|
+
|
|
762
|
+
Price: $0.002 per request.
|
|
763
|
+
|
|
764
|
+
Example:
|
|
765
|
+
res = client.youtube.search(query="how to cook rice")
|
|
766
|
+
"""
|
|
767
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
768
|
+
"youtube.search", dict(input), options
|
|
769
|
+
)
|
|
770
|
+
return RunResult[YoutubeSearchData].model_validate(raw)
|
|
771
|
+
|
|
772
|
+
def search_hashtag(
|
|
773
|
+
self,
|
|
774
|
+
*,
|
|
775
|
+
options: RequestOptions | None = None,
|
|
776
|
+
**input: Unpack[YoutubeSearchHashtagInput],
|
|
777
|
+
) -> RunResult[YoutubeSearchHashtagData]:
|
|
778
|
+
"""YouTube Hashtag Search
|
|
779
|
+
|
|
780
|
+
Search YouTube videos by hashtag with cursor pagination (title, channel,
|
|
781
|
+
views, length, publish time), normalized across providers.
|
|
782
|
+
|
|
783
|
+
Price: $0.002 per request.
|
|
784
|
+
|
|
785
|
+
Example:
|
|
786
|
+
res = client.youtube.search_hashtag(hashtag="funny")
|
|
787
|
+
"""
|
|
788
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
789
|
+
"youtube.search_hashtag", dict(input), options
|
|
790
|
+
)
|
|
791
|
+
return RunResult[YoutubeSearchHashtagData].model_validate(raw)
|
|
792
|
+
|
|
793
|
+
def iter_search_hashtag(
|
|
794
|
+
self,
|
|
795
|
+
*,
|
|
796
|
+
options: RequestOptions | None = None,
|
|
797
|
+
**input: Unpack[YoutubeSearchHashtagInput],
|
|
798
|
+
) -> Paginator[YoutubeSearchHashtagVideo, YoutubeSearchHashtagData]:
|
|
799
|
+
"""Iterate YouTube Hashtag Search results, following pagination cursors.
|
|
800
|
+
|
|
801
|
+
Yields validated `YoutubeSearchHashtagVideo` items from the `videos` field of
|
|
802
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
803
|
+
`RunResult` pages.
|
|
804
|
+
"""
|
|
805
|
+
return paginate(
|
|
806
|
+
self._client,
|
|
807
|
+
"youtube.search_hashtag",
|
|
808
|
+
dict(input),
|
|
809
|
+
"videos",
|
|
810
|
+
item_model=YoutubeSearchHashtagVideo,
|
|
811
|
+
data_model=YoutubeSearchHashtagData,
|
|
812
|
+
bare=False,
|
|
813
|
+
options=options,
|
|
814
|
+
)
|
|
815
|
+
|
|
816
|
+
def trending_shorts(
|
|
817
|
+
self,
|
|
818
|
+
*,
|
|
819
|
+
options: RequestOptions | None = None,
|
|
820
|
+
**input: Unpack[YoutubeTrendingShortsInput],
|
|
821
|
+
) -> RunResult[YoutubeTrendingShortsData]:
|
|
822
|
+
"""YouTube Trending Shorts
|
|
823
|
+
|
|
824
|
+
List currently trending YouTube Shorts (title, channel, views, likes,
|
|
825
|
+
duration), normalized across providers.
|
|
826
|
+
|
|
827
|
+
Price: $0.002 per request.
|
|
828
|
+
|
|
829
|
+
Example:
|
|
830
|
+
res = client.youtube.trending_shorts()
|
|
831
|
+
"""
|
|
832
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
833
|
+
"youtube.trending_shorts", dict(input), options
|
|
834
|
+
)
|
|
835
|
+
return RunResult[YoutubeTrendingShortsData].model_validate(raw)
|
|
836
|
+
|
|
837
|
+
def video(
|
|
838
|
+
self,
|
|
839
|
+
*,
|
|
840
|
+
options: RequestOptions | None = None,
|
|
841
|
+
**input: Unpack[YoutubeVideoInput],
|
|
842
|
+
) -> RunResult[YoutubeVideoData]:
|
|
843
|
+
"""YouTube Video
|
|
844
|
+
|
|
845
|
+
Fetch a YouTube video's metadata (title, channel, views, likes, duration,
|
|
846
|
+
publish date) by URL or ID, normalized across providers.
|
|
847
|
+
|
|
848
|
+
Price: $0.002 per request.
|
|
849
|
+
|
|
850
|
+
Example:
|
|
851
|
+
res = client.youtube.video(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
|
|
852
|
+
"""
|
|
853
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
854
|
+
"youtube.video", dict(input), options
|
|
855
|
+
)
|
|
856
|
+
return RunResult[YoutubeVideoData].model_validate(raw)
|
|
857
|
+
|
|
858
|
+
def video_comments(
|
|
859
|
+
self,
|
|
860
|
+
*,
|
|
861
|
+
options: RequestOptions | None = None,
|
|
862
|
+
**input: Unpack[YoutubeVideoCommentsInput],
|
|
863
|
+
) -> RunResult[YoutubeVideoCommentsData]:
|
|
864
|
+
"""YouTube Video Comments
|
|
865
|
+
|
|
866
|
+
List the comments on a YouTube video by URL with cursor pagination (text,
|
|
867
|
+
author, likes, reply count), normalized across providers.
|
|
868
|
+
|
|
869
|
+
Price: $0.002 per request.
|
|
870
|
+
|
|
871
|
+
Example:
|
|
872
|
+
res = client.youtube.video_comments(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
|
|
873
|
+
"""
|
|
874
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
875
|
+
"youtube.video_comments", dict(input), options
|
|
876
|
+
)
|
|
877
|
+
return RunResult[YoutubeVideoCommentsData].model_validate(raw)
|
|
878
|
+
|
|
879
|
+
def iter_video_comments(
|
|
880
|
+
self,
|
|
881
|
+
*,
|
|
882
|
+
options: RequestOptions | None = None,
|
|
883
|
+
**input: Unpack[YoutubeVideoCommentsInput],
|
|
884
|
+
) -> Paginator[YoutubeVideoCommentsComment, YoutubeVideoCommentsData]:
|
|
885
|
+
"""Iterate YouTube Video Comments results, following pagination cursors.
|
|
886
|
+
|
|
887
|
+
Yields validated `YoutubeVideoCommentsComment` items from the `comments` field of
|
|
888
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
889
|
+
`RunResult` pages.
|
|
890
|
+
"""
|
|
891
|
+
return paginate(
|
|
892
|
+
self._client,
|
|
893
|
+
"youtube.video_comments",
|
|
894
|
+
dict(input),
|
|
895
|
+
"comments",
|
|
896
|
+
item_model=YoutubeVideoCommentsComment,
|
|
897
|
+
data_model=YoutubeVideoCommentsData,
|
|
898
|
+
bare=False,
|
|
899
|
+
options=options,
|
|
900
|
+
)
|
|
901
|
+
|
|
902
|
+
def video_sponsors(
|
|
903
|
+
self,
|
|
904
|
+
*,
|
|
905
|
+
options: RequestOptions | None = None,
|
|
906
|
+
**input: Unpack[YoutubeVideoSponsorsInput],
|
|
907
|
+
) -> RunResult[YoutubeVideoSponsorsData]:
|
|
908
|
+
"""YouTube Video Sponsors
|
|
909
|
+
|
|
910
|
+
Detect suspected sponsors and paid promotions in a YouTube video by URL
|
|
911
|
+
(sponsor names, websites, confidence), normalized across providers.
|
|
912
|
+
|
|
913
|
+
Price: $0.002 per request.
|
|
914
|
+
|
|
915
|
+
Example:
|
|
916
|
+
res = client.youtube.video_sponsors(url="https://www.youtube.com/watch?v=AVO0ifle-OU")
|
|
917
|
+
"""
|
|
918
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
919
|
+
"youtube.video_sponsors", dict(input), options
|
|
920
|
+
)
|
|
921
|
+
return RunResult[YoutubeVideoSponsorsData].model_validate(raw)
|
|
922
|
+
|
|
923
|
+
def video_transcript(
|
|
924
|
+
self,
|
|
925
|
+
*,
|
|
926
|
+
options: RequestOptions | None = None,
|
|
927
|
+
**input: Unpack[YoutubeVideoTranscriptInput],
|
|
928
|
+
) -> RunResult[YoutubeVideoTranscriptData]:
|
|
929
|
+
"""YouTube Video Transcript
|
|
930
|
+
|
|
931
|
+
Fetch the transcript/captions of a YouTube video by URL or ID, normalized
|
|
932
|
+
across providers with transparent failover.
|
|
933
|
+
|
|
934
|
+
Price: $0.002 per request.
|
|
935
|
+
|
|
936
|
+
Example:
|
|
937
|
+
res = client.youtube.video_transcript(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
|
|
938
|
+
"""
|
|
939
|
+
raw = self._client._run_raw( # pyright: ignore[reportPrivateUsage]
|
|
940
|
+
"youtube.video_transcript", dict(input), options
|
|
941
|
+
)
|
|
942
|
+
return RunResult[YoutubeVideoTranscriptData].model_validate(raw)
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
class AsyncYoutubeNamespace:
|
|
946
|
+
"""Typed methods for this platform. Attached lazily to the client."""
|
|
947
|
+
|
|
948
|
+
def __init__(self, client: "AsyncAnyAPI") -> None:
|
|
949
|
+
self._client = client
|
|
950
|
+
|
|
951
|
+
async def channel(
|
|
952
|
+
self,
|
|
953
|
+
*,
|
|
954
|
+
options: RequestOptions | None = None,
|
|
955
|
+
**input: Unpack[YoutubeChannelInput],
|
|
956
|
+
) -> RunResult[YoutubeChannelData]:
|
|
957
|
+
"""YouTube Channel
|
|
958
|
+
|
|
959
|
+
Fetch a YouTube channel's stats (subscribers, video count, total views,
|
|
960
|
+
description) by handle or channel ID, normalized across providers.
|
|
961
|
+
|
|
962
|
+
Price: $0.002 per request.
|
|
963
|
+
|
|
964
|
+
Example:
|
|
965
|
+
res = client.youtube.channel(handle="@mkbhd")
|
|
966
|
+
"""
|
|
967
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
968
|
+
"youtube.channel", dict(input), options
|
|
969
|
+
)
|
|
970
|
+
return RunResult[YoutubeChannelData].model_validate(raw)
|
|
971
|
+
|
|
972
|
+
async def channel_community_posts(
|
|
973
|
+
self,
|
|
974
|
+
*,
|
|
975
|
+
options: RequestOptions | None = None,
|
|
976
|
+
**input: Unpack[YoutubeChannelCommunityPostsInput],
|
|
977
|
+
) -> RunResult[YoutubeChannelCommunityPostsData]:
|
|
978
|
+
"""YouTube Channel Community Posts
|
|
979
|
+
|
|
980
|
+
List a YouTube channel's community posts by handle or channel ID with cursor
|
|
981
|
+
pagination (text, likes, image, publish time), normalized across providers.
|
|
982
|
+
|
|
983
|
+
Price: $0.002 per request.
|
|
984
|
+
|
|
985
|
+
Example:
|
|
986
|
+
res = client.youtube.channel_community_posts(handle="@MrBeast")
|
|
987
|
+
"""
|
|
988
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
989
|
+
"youtube.channel_community_posts", dict(input), options
|
|
990
|
+
)
|
|
991
|
+
return RunResult[YoutubeChannelCommunityPostsData].model_validate(raw)
|
|
992
|
+
|
|
993
|
+
def iter_channel_community_posts(
|
|
994
|
+
self,
|
|
995
|
+
*,
|
|
996
|
+
options: RequestOptions | None = None,
|
|
997
|
+
**input: Unpack[YoutubeChannelCommunityPostsInput],
|
|
998
|
+
) -> AsyncPaginator[
|
|
999
|
+
YoutubeChannelCommunityPostsPost, YoutubeChannelCommunityPostsData
|
|
1000
|
+
]:
|
|
1001
|
+
"""Iterate YouTube Channel Community Posts results, following pagination cursors.
|
|
1002
|
+
|
|
1003
|
+
Yields validated `YoutubeChannelCommunityPostsPost` items from the `posts` field of
|
|
1004
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
1005
|
+
`RunResult` pages.
|
|
1006
|
+
"""
|
|
1007
|
+
return apaginate(
|
|
1008
|
+
self._client,
|
|
1009
|
+
"youtube.channel_community_posts",
|
|
1010
|
+
dict(input),
|
|
1011
|
+
"posts",
|
|
1012
|
+
item_model=YoutubeChannelCommunityPostsPost,
|
|
1013
|
+
data_model=YoutubeChannelCommunityPostsData,
|
|
1014
|
+
bare=False,
|
|
1015
|
+
options=options,
|
|
1016
|
+
)
|
|
1017
|
+
|
|
1018
|
+
async def channel_lives(
|
|
1019
|
+
self,
|
|
1020
|
+
*,
|
|
1021
|
+
options: RequestOptions | None = None,
|
|
1022
|
+
**input: Unpack[YoutubeChannelLivesInput],
|
|
1023
|
+
) -> RunResult[YoutubeChannelLivesData]:
|
|
1024
|
+
"""YouTube Channel Live Streams
|
|
1025
|
+
|
|
1026
|
+
List a YouTube channel's live and past-live streams by handle or channel ID
|
|
1027
|
+
with cursor pagination (title, views, length, publish time), normalized
|
|
1028
|
+
across providers.
|
|
1029
|
+
|
|
1030
|
+
Price: $0.002 per request.
|
|
1031
|
+
|
|
1032
|
+
Example:
|
|
1033
|
+
res = client.youtube.channel_lives(handle="@IShowSpeed")
|
|
1034
|
+
"""
|
|
1035
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1036
|
+
"youtube.channel_lives", dict(input), options
|
|
1037
|
+
)
|
|
1038
|
+
return RunResult[YoutubeChannelLivesData].model_validate(raw)
|
|
1039
|
+
|
|
1040
|
+
def iter_channel_lives(
|
|
1041
|
+
self,
|
|
1042
|
+
*,
|
|
1043
|
+
options: RequestOptions | None = None,
|
|
1044
|
+
**input: Unpack[YoutubeChannelLivesInput],
|
|
1045
|
+
) -> AsyncPaginator[YoutubeChannelLivesLive, YoutubeChannelLivesData]:
|
|
1046
|
+
"""Iterate YouTube Channel Live Streams results, following pagination cursors.
|
|
1047
|
+
|
|
1048
|
+
Yields validated `YoutubeChannelLivesLive` items from the `lives` field of
|
|
1049
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
1050
|
+
`RunResult` pages.
|
|
1051
|
+
"""
|
|
1052
|
+
return apaginate(
|
|
1053
|
+
self._client,
|
|
1054
|
+
"youtube.channel_lives",
|
|
1055
|
+
dict(input),
|
|
1056
|
+
"lives",
|
|
1057
|
+
item_model=YoutubeChannelLivesLive,
|
|
1058
|
+
data_model=YoutubeChannelLivesData,
|
|
1059
|
+
bare=False,
|
|
1060
|
+
options=options,
|
|
1061
|
+
)
|
|
1062
|
+
|
|
1063
|
+
async def channel_playlists(
|
|
1064
|
+
self,
|
|
1065
|
+
*,
|
|
1066
|
+
options: RequestOptions | None = None,
|
|
1067
|
+
**input: Unpack[YoutubeChannelPlaylistsInput],
|
|
1068
|
+
) -> RunResult[YoutubeChannelPlaylistsData]:
|
|
1069
|
+
"""YouTube Channel Playlists
|
|
1070
|
+
|
|
1071
|
+
List a YouTube channel's playlists by handle or channel ID with cursor
|
|
1072
|
+
pagination (title, video count, thumbnail), normalized across providers.
|
|
1073
|
+
|
|
1074
|
+
Price: $0.002 per request.
|
|
1075
|
+
|
|
1076
|
+
Example:
|
|
1077
|
+
res = client.youtube.channel_playlists(handle="@veritasium")
|
|
1078
|
+
"""
|
|
1079
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1080
|
+
"youtube.channel_playlists", dict(input), options
|
|
1081
|
+
)
|
|
1082
|
+
return RunResult[YoutubeChannelPlaylistsData].model_validate(raw)
|
|
1083
|
+
|
|
1084
|
+
def iter_channel_playlists(
|
|
1085
|
+
self,
|
|
1086
|
+
*,
|
|
1087
|
+
options: RequestOptions | None = None,
|
|
1088
|
+
**input: Unpack[YoutubeChannelPlaylistsInput],
|
|
1089
|
+
) -> AsyncPaginator[YoutubeChannelPlaylistsPlaylist, YoutubeChannelPlaylistsData]:
|
|
1090
|
+
"""Iterate YouTube Channel Playlists results, following pagination cursors.
|
|
1091
|
+
|
|
1092
|
+
Yields validated `YoutubeChannelPlaylistsPlaylist` items from the `playlists` field of
|
|
1093
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
1094
|
+
`RunResult` pages.
|
|
1095
|
+
"""
|
|
1096
|
+
return apaginate(
|
|
1097
|
+
self._client,
|
|
1098
|
+
"youtube.channel_playlists",
|
|
1099
|
+
dict(input),
|
|
1100
|
+
"playlists",
|
|
1101
|
+
item_model=YoutubeChannelPlaylistsPlaylist,
|
|
1102
|
+
data_model=YoutubeChannelPlaylistsData,
|
|
1103
|
+
bare=False,
|
|
1104
|
+
options=options,
|
|
1105
|
+
)
|
|
1106
|
+
|
|
1107
|
+
async def channel_shorts(
|
|
1108
|
+
self,
|
|
1109
|
+
*,
|
|
1110
|
+
options: RequestOptions | None = None,
|
|
1111
|
+
**input: Unpack[YoutubeChannelShortsInput],
|
|
1112
|
+
) -> RunResult[YoutubeChannelShortsData]:
|
|
1113
|
+
"""YouTube Channel Shorts
|
|
1114
|
+
|
|
1115
|
+
List a YouTube channel's Shorts by handle or channel ID with cursor
|
|
1116
|
+
pagination (title, views, likes, duration), normalized across providers.
|
|
1117
|
+
|
|
1118
|
+
Price: $0.002 per request.
|
|
1119
|
+
|
|
1120
|
+
Example:
|
|
1121
|
+
res = client.youtube.channel_shorts(handle="@starterstory")
|
|
1122
|
+
"""
|
|
1123
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1124
|
+
"youtube.channel_shorts", dict(input), options
|
|
1125
|
+
)
|
|
1126
|
+
return RunResult[YoutubeChannelShortsData].model_validate(raw)
|
|
1127
|
+
|
|
1128
|
+
def iter_channel_shorts(
|
|
1129
|
+
self,
|
|
1130
|
+
*,
|
|
1131
|
+
options: RequestOptions | None = None,
|
|
1132
|
+
**input: Unpack[YoutubeChannelShortsInput],
|
|
1133
|
+
) -> AsyncPaginator[YoutubeChannelShortsShort, YoutubeChannelShortsData]:
|
|
1134
|
+
"""Iterate YouTube Channel Shorts results, following pagination cursors.
|
|
1135
|
+
|
|
1136
|
+
Yields validated `YoutubeChannelShortsShort` items from the `shorts` field of
|
|
1137
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
1138
|
+
`RunResult` pages.
|
|
1139
|
+
"""
|
|
1140
|
+
return apaginate(
|
|
1141
|
+
self._client,
|
|
1142
|
+
"youtube.channel_shorts",
|
|
1143
|
+
dict(input),
|
|
1144
|
+
"shorts",
|
|
1145
|
+
item_model=YoutubeChannelShortsShort,
|
|
1146
|
+
data_model=YoutubeChannelShortsData,
|
|
1147
|
+
bare=False,
|
|
1148
|
+
options=options,
|
|
1149
|
+
)
|
|
1150
|
+
|
|
1151
|
+
async def channel_videos(
|
|
1152
|
+
self,
|
|
1153
|
+
*,
|
|
1154
|
+
options: RequestOptions | None = None,
|
|
1155
|
+
**input: Unpack[YoutubeChannelVideosInput],
|
|
1156
|
+
) -> RunResult[YoutubeChannelVideosData]:
|
|
1157
|
+
"""YouTube Channel Videos
|
|
1158
|
+
|
|
1159
|
+
List a YouTube channel's videos by handle or channel ID with cursor
|
|
1160
|
+
pagination (title, views, length, publish time), normalized across
|
|
1161
|
+
providers.
|
|
1162
|
+
|
|
1163
|
+
Price: $0.002 per request.
|
|
1164
|
+
|
|
1165
|
+
Example:
|
|
1166
|
+
res = client.youtube.channel_videos(handle="@mkbhd")
|
|
1167
|
+
"""
|
|
1168
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1169
|
+
"youtube.channel_videos", dict(input), options
|
|
1170
|
+
)
|
|
1171
|
+
return RunResult[YoutubeChannelVideosData].model_validate(raw)
|
|
1172
|
+
|
|
1173
|
+
def iter_channel_videos(
|
|
1174
|
+
self,
|
|
1175
|
+
*,
|
|
1176
|
+
options: RequestOptions | None = None,
|
|
1177
|
+
**input: Unpack[YoutubeChannelVideosInput],
|
|
1178
|
+
) -> AsyncPaginator[YoutubeChannelVideosVideo, YoutubeChannelVideosData]:
|
|
1179
|
+
"""Iterate YouTube Channel Videos results, following pagination cursors.
|
|
1180
|
+
|
|
1181
|
+
Yields validated `YoutubeChannelVideosVideo` items from the `videos` field of
|
|
1182
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
1183
|
+
`RunResult` pages.
|
|
1184
|
+
"""
|
|
1185
|
+
return apaginate(
|
|
1186
|
+
self._client,
|
|
1187
|
+
"youtube.channel_videos",
|
|
1188
|
+
dict(input),
|
|
1189
|
+
"videos",
|
|
1190
|
+
item_model=YoutubeChannelVideosVideo,
|
|
1191
|
+
data_model=YoutubeChannelVideosData,
|
|
1192
|
+
bare=False,
|
|
1193
|
+
options=options,
|
|
1194
|
+
)
|
|
1195
|
+
|
|
1196
|
+
async def comment_replies(
|
|
1197
|
+
self,
|
|
1198
|
+
*,
|
|
1199
|
+
options: RequestOptions | None = None,
|
|
1200
|
+
**input: Unpack[YoutubeCommentRepliesInput],
|
|
1201
|
+
) -> RunResult[YoutubeCommentRepliesData]:
|
|
1202
|
+
"""YouTube Comment Replies
|
|
1203
|
+
|
|
1204
|
+
List replies to a YouTube comment using a continuation token with cursor
|
|
1205
|
+
pagination (text, author, likes, publish time), normalized across providers.
|
|
1206
|
+
|
|
1207
|
+
Price: $0.002 per request.
|
|
1208
|
+
|
|
1209
|
+
Example:
|
|
1210
|
+
res = client.youtube.comment_replies(continuationToken="Eg0SC19fZm1EajBaSjFRGAYygwEaUBIaVWd3aXRjRk9fdmtpM0x4LUNfZDRBYUFCQWciAggAKhhVQ1g2T1EzRGtjc2JZTkU2SDh1UVF1VkEyC19fZm1EajBaSjFRQABICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dpdGNGT192a2kzTHgtQ19kNEFhQUJBZw==")
|
|
1211
|
+
"""
|
|
1212
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1213
|
+
"youtube.comment_replies", dict(input), options
|
|
1214
|
+
)
|
|
1215
|
+
return RunResult[YoutubeCommentRepliesData].model_validate(raw)
|
|
1216
|
+
|
|
1217
|
+
async def community_post(
|
|
1218
|
+
self,
|
|
1219
|
+
*,
|
|
1220
|
+
options: RequestOptions | None = None,
|
|
1221
|
+
**input: Unpack[YoutubeCommunityPostInput],
|
|
1222
|
+
) -> RunResult[YoutubeCommunityPostData]:
|
|
1223
|
+
"""YouTube Community Post
|
|
1224
|
+
|
|
1225
|
+
Fetch a single YouTube community post by URL (text, images, channel, publish
|
|
1226
|
+
time), normalized across providers.
|
|
1227
|
+
|
|
1228
|
+
Price: $0.002 per request.
|
|
1229
|
+
|
|
1230
|
+
Example:
|
|
1231
|
+
res = client.youtube.community_post(url="https://www.youtube.com/post/Ugkx1LonSRBBUqASv-J8j9_FesxwlMAhT3_e")
|
|
1232
|
+
"""
|
|
1233
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1234
|
+
"youtube.community_post", dict(input), options
|
|
1235
|
+
)
|
|
1236
|
+
return RunResult[YoutubeCommunityPostData].model_validate(raw)
|
|
1237
|
+
|
|
1238
|
+
async def playlist(
|
|
1239
|
+
self,
|
|
1240
|
+
*,
|
|
1241
|
+
options: RequestOptions | None = None,
|
|
1242
|
+
**input: Unpack[YoutubePlaylistInput],
|
|
1243
|
+
) -> RunResult[YoutubePlaylistData]:
|
|
1244
|
+
"""YouTube Playlist
|
|
1245
|
+
|
|
1246
|
+
List every video in a YouTube playlist - title, length, and channel per
|
|
1247
|
+
video plus playlist owner and totals - normalized across providers with
|
|
1248
|
+
transparent failover.
|
|
1249
|
+
|
|
1250
|
+
Price: $0.002 per request.
|
|
1251
|
+
|
|
1252
|
+
Example:
|
|
1253
|
+
res = client.youtube.playlist(playlistId="PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj")
|
|
1254
|
+
"""
|
|
1255
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1256
|
+
"youtube.playlist", dict(input), options
|
|
1257
|
+
)
|
|
1258
|
+
return RunResult[YoutubePlaylistData].model_validate(raw)
|
|
1259
|
+
|
|
1260
|
+
async def search(
|
|
1261
|
+
self,
|
|
1262
|
+
*,
|
|
1263
|
+
options: RequestOptions | None = None,
|
|
1264
|
+
**input: Unpack[YoutubeSearchInput],
|
|
1265
|
+
) -> RunResult[YoutubeSearchData]:
|
|
1266
|
+
"""YouTube Search
|
|
1267
|
+
|
|
1268
|
+
Search YouTube and get matching videos (title, channel, views, length,
|
|
1269
|
+
publish time) as normalized JSON, across providers with transparent
|
|
1270
|
+
failover.
|
|
1271
|
+
|
|
1272
|
+
Price: $0.002 per request.
|
|
1273
|
+
|
|
1274
|
+
Example:
|
|
1275
|
+
res = client.youtube.search(query="how to cook rice")
|
|
1276
|
+
"""
|
|
1277
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1278
|
+
"youtube.search", dict(input), options
|
|
1279
|
+
)
|
|
1280
|
+
return RunResult[YoutubeSearchData].model_validate(raw)
|
|
1281
|
+
|
|
1282
|
+
async def search_hashtag(
|
|
1283
|
+
self,
|
|
1284
|
+
*,
|
|
1285
|
+
options: RequestOptions | None = None,
|
|
1286
|
+
**input: Unpack[YoutubeSearchHashtagInput],
|
|
1287
|
+
) -> RunResult[YoutubeSearchHashtagData]:
|
|
1288
|
+
"""YouTube Hashtag Search
|
|
1289
|
+
|
|
1290
|
+
Search YouTube videos by hashtag with cursor pagination (title, channel,
|
|
1291
|
+
views, length, publish time), normalized across providers.
|
|
1292
|
+
|
|
1293
|
+
Price: $0.002 per request.
|
|
1294
|
+
|
|
1295
|
+
Example:
|
|
1296
|
+
res = client.youtube.search_hashtag(hashtag="funny")
|
|
1297
|
+
"""
|
|
1298
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1299
|
+
"youtube.search_hashtag", dict(input), options
|
|
1300
|
+
)
|
|
1301
|
+
return RunResult[YoutubeSearchHashtagData].model_validate(raw)
|
|
1302
|
+
|
|
1303
|
+
def iter_search_hashtag(
|
|
1304
|
+
self,
|
|
1305
|
+
*,
|
|
1306
|
+
options: RequestOptions | None = None,
|
|
1307
|
+
**input: Unpack[YoutubeSearchHashtagInput],
|
|
1308
|
+
) -> AsyncPaginator[YoutubeSearchHashtagVideo, YoutubeSearchHashtagData]:
|
|
1309
|
+
"""Iterate YouTube Hashtag Search results, following pagination cursors.
|
|
1310
|
+
|
|
1311
|
+
Yields validated `YoutubeSearchHashtagVideo` items from the `videos` field of
|
|
1312
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
1313
|
+
`RunResult` pages.
|
|
1314
|
+
"""
|
|
1315
|
+
return apaginate(
|
|
1316
|
+
self._client,
|
|
1317
|
+
"youtube.search_hashtag",
|
|
1318
|
+
dict(input),
|
|
1319
|
+
"videos",
|
|
1320
|
+
item_model=YoutubeSearchHashtagVideo,
|
|
1321
|
+
data_model=YoutubeSearchHashtagData,
|
|
1322
|
+
bare=False,
|
|
1323
|
+
options=options,
|
|
1324
|
+
)
|
|
1325
|
+
|
|
1326
|
+
async def trending_shorts(
|
|
1327
|
+
self,
|
|
1328
|
+
*,
|
|
1329
|
+
options: RequestOptions | None = None,
|
|
1330
|
+
**input: Unpack[YoutubeTrendingShortsInput],
|
|
1331
|
+
) -> RunResult[YoutubeTrendingShortsData]:
|
|
1332
|
+
"""YouTube Trending Shorts
|
|
1333
|
+
|
|
1334
|
+
List currently trending YouTube Shorts (title, channel, views, likes,
|
|
1335
|
+
duration), normalized across providers.
|
|
1336
|
+
|
|
1337
|
+
Price: $0.002 per request.
|
|
1338
|
+
|
|
1339
|
+
Example:
|
|
1340
|
+
res = client.youtube.trending_shorts()
|
|
1341
|
+
"""
|
|
1342
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1343
|
+
"youtube.trending_shorts", dict(input), options
|
|
1344
|
+
)
|
|
1345
|
+
return RunResult[YoutubeTrendingShortsData].model_validate(raw)
|
|
1346
|
+
|
|
1347
|
+
async def video(
|
|
1348
|
+
self,
|
|
1349
|
+
*,
|
|
1350
|
+
options: RequestOptions | None = None,
|
|
1351
|
+
**input: Unpack[YoutubeVideoInput],
|
|
1352
|
+
) -> RunResult[YoutubeVideoData]:
|
|
1353
|
+
"""YouTube Video
|
|
1354
|
+
|
|
1355
|
+
Fetch a YouTube video's metadata (title, channel, views, likes, duration,
|
|
1356
|
+
publish date) by URL or ID, normalized across providers.
|
|
1357
|
+
|
|
1358
|
+
Price: $0.002 per request.
|
|
1359
|
+
|
|
1360
|
+
Example:
|
|
1361
|
+
res = client.youtube.video(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
|
|
1362
|
+
"""
|
|
1363
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1364
|
+
"youtube.video", dict(input), options
|
|
1365
|
+
)
|
|
1366
|
+
return RunResult[YoutubeVideoData].model_validate(raw)
|
|
1367
|
+
|
|
1368
|
+
async def video_comments(
|
|
1369
|
+
self,
|
|
1370
|
+
*,
|
|
1371
|
+
options: RequestOptions | None = None,
|
|
1372
|
+
**input: Unpack[YoutubeVideoCommentsInput],
|
|
1373
|
+
) -> RunResult[YoutubeVideoCommentsData]:
|
|
1374
|
+
"""YouTube Video Comments
|
|
1375
|
+
|
|
1376
|
+
List the comments on a YouTube video by URL with cursor pagination (text,
|
|
1377
|
+
author, likes, reply count), normalized across providers.
|
|
1378
|
+
|
|
1379
|
+
Price: $0.002 per request.
|
|
1380
|
+
|
|
1381
|
+
Example:
|
|
1382
|
+
res = client.youtube.video_comments(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
|
|
1383
|
+
"""
|
|
1384
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1385
|
+
"youtube.video_comments", dict(input), options
|
|
1386
|
+
)
|
|
1387
|
+
return RunResult[YoutubeVideoCommentsData].model_validate(raw)
|
|
1388
|
+
|
|
1389
|
+
def iter_video_comments(
|
|
1390
|
+
self,
|
|
1391
|
+
*,
|
|
1392
|
+
options: RequestOptions | None = None,
|
|
1393
|
+
**input: Unpack[YoutubeVideoCommentsInput],
|
|
1394
|
+
) -> AsyncPaginator[YoutubeVideoCommentsComment, YoutubeVideoCommentsData]:
|
|
1395
|
+
"""Iterate YouTube Video Comments results, following pagination cursors.
|
|
1396
|
+
|
|
1397
|
+
Yields validated `YoutubeVideoCommentsComment` items from the `comments` field of
|
|
1398
|
+
each page. Use `.pages()` on the returned paginator to walk whole
|
|
1399
|
+
`RunResult` pages.
|
|
1400
|
+
"""
|
|
1401
|
+
return apaginate(
|
|
1402
|
+
self._client,
|
|
1403
|
+
"youtube.video_comments",
|
|
1404
|
+
dict(input),
|
|
1405
|
+
"comments",
|
|
1406
|
+
item_model=YoutubeVideoCommentsComment,
|
|
1407
|
+
data_model=YoutubeVideoCommentsData,
|
|
1408
|
+
bare=False,
|
|
1409
|
+
options=options,
|
|
1410
|
+
)
|
|
1411
|
+
|
|
1412
|
+
async def video_sponsors(
|
|
1413
|
+
self,
|
|
1414
|
+
*,
|
|
1415
|
+
options: RequestOptions | None = None,
|
|
1416
|
+
**input: Unpack[YoutubeVideoSponsorsInput],
|
|
1417
|
+
) -> RunResult[YoutubeVideoSponsorsData]:
|
|
1418
|
+
"""YouTube Video Sponsors
|
|
1419
|
+
|
|
1420
|
+
Detect suspected sponsors and paid promotions in a YouTube video by URL
|
|
1421
|
+
(sponsor names, websites, confidence), normalized across providers.
|
|
1422
|
+
|
|
1423
|
+
Price: $0.002 per request.
|
|
1424
|
+
|
|
1425
|
+
Example:
|
|
1426
|
+
res = client.youtube.video_sponsors(url="https://www.youtube.com/watch?v=AVO0ifle-OU")
|
|
1427
|
+
"""
|
|
1428
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1429
|
+
"youtube.video_sponsors", dict(input), options
|
|
1430
|
+
)
|
|
1431
|
+
return RunResult[YoutubeVideoSponsorsData].model_validate(raw)
|
|
1432
|
+
|
|
1433
|
+
async def video_transcript(
|
|
1434
|
+
self,
|
|
1435
|
+
*,
|
|
1436
|
+
options: RequestOptions | None = None,
|
|
1437
|
+
**input: Unpack[YoutubeVideoTranscriptInput],
|
|
1438
|
+
) -> RunResult[YoutubeVideoTranscriptData]:
|
|
1439
|
+
"""YouTube Video Transcript
|
|
1440
|
+
|
|
1441
|
+
Fetch the transcript/captions of a YouTube video by URL or ID, normalized
|
|
1442
|
+
across providers with transparent failover.
|
|
1443
|
+
|
|
1444
|
+
Price: $0.002 per request.
|
|
1445
|
+
|
|
1446
|
+
Example:
|
|
1447
|
+
res = client.youtube.video_transcript(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
|
|
1448
|
+
"""
|
|
1449
|
+
raw = await self._client._arun_raw( # pyright: ignore[reportPrivateUsage]
|
|
1450
|
+
"youtube.video_transcript", dict(input), options
|
|
1451
|
+
)
|
|
1452
|
+
return RunResult[YoutubeVideoTranscriptData].model_validate(raw)
|