universal-mcp 0.1.7rc1__py3-none-any.whl → 0.1.8__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.
- universal_mcp/__init__.py +0 -2
- universal_mcp/analytics.py +75 -0
- universal_mcp/applications/ahrefs/README.md +76 -0
- universal_mcp/applications/ahrefs/app.py +2291 -0
- universal_mcp/applications/application.py +95 -5
- universal_mcp/applications/calendly/README.md +78 -0
- universal_mcp/applications/calendly/__init__.py +0 -0
- universal_mcp/applications/calendly/app.py +1195 -0
- universal_mcp/applications/coda/README.md +133 -0
- universal_mcp/applications/coda/__init__.py +0 -0
- universal_mcp/applications/coda/app.py +3671 -0
- universal_mcp/applications/e2b/app.py +14 -28
- universal_mcp/applications/figma/README.md +74 -0
- universal_mcp/applications/figma/__init__.py +0 -0
- universal_mcp/applications/figma/app.py +1261 -0
- universal_mcp/applications/firecrawl/app.py +38 -35
- universal_mcp/applications/github/app.py +127 -85
- universal_mcp/applications/google_calendar/app.py +62 -138
- universal_mcp/applications/google_docs/app.py +47 -52
- universal_mcp/applications/google_drive/app.py +119 -113
- universal_mcp/applications/google_mail/app.py +124 -50
- universal_mcp/applications/google_sheet/app.py +89 -91
- universal_mcp/applications/markitdown/app.py +9 -8
- universal_mcp/applications/notion/app.py +254 -134
- universal_mcp/applications/perplexity/app.py +13 -41
- universal_mcp/applications/reddit/app.py +94 -85
- universal_mcp/applications/resend/app.py +12 -13
- universal_mcp/applications/{serp → serpapi}/app.py +14 -25
- universal_mcp/applications/tavily/app.py +11 -18
- universal_mcp/applications/wrike/README.md +71 -0
- universal_mcp/applications/wrike/__init__.py +0 -0
- universal_mcp/applications/wrike/app.py +1372 -0
- universal_mcp/applications/youtube/README.md +82 -0
- universal_mcp/applications/youtube/__init__.py +0 -0
- universal_mcp/applications/youtube/app.py +1428 -0
- universal_mcp/applications/zenquotes/app.py +12 -2
- universal_mcp/exceptions.py +9 -2
- universal_mcp/integrations/__init__.py +24 -1
- universal_mcp/integrations/agentr.py +27 -4
- universal_mcp/integrations/integration.py +146 -32
- universal_mcp/logger.py +3 -56
- universal_mcp/servers/__init__.py +6 -14
- universal_mcp/servers/server.py +201 -146
- universal_mcp/stores/__init__.py +7 -2
- universal_mcp/stores/store.py +103 -40
- universal_mcp/tools/__init__.py +3 -0
- universal_mcp/tools/adapters.py +43 -0
- universal_mcp/tools/func_metadata.py +213 -0
- universal_mcp/tools/tools.py +342 -0
- universal_mcp/utils/docgen.py +325 -119
- universal_mcp/utils/docstring_parser.py +179 -0
- universal_mcp/utils/dump_app_tools.py +33 -23
- universal_mcp/utils/installation.py +201 -10
- universal_mcp/utils/openapi.py +229 -46
- {universal_mcp-0.1.7rc1.dist-info → universal_mcp-0.1.8.dist-info}/METADATA +9 -5
- universal_mcp-0.1.8.dist-info/RECORD +81 -0
- universal_mcp-0.1.7rc1.dist-info/RECORD +0 -58
- /universal_mcp/{utils/bridge.py → applications/ahrefs/__init__.py} +0 -0
- /universal_mcp/applications/{serp → serpapi}/README.md +0 -0
- {universal_mcp-0.1.7rc1.dist-info → universal_mcp-0.1.8.dist-info}/WHEEL +0 -0
- {universal_mcp-0.1.7rc1.dist-info → universal_mcp-0.1.8.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,1428 @@
|
|
1
|
+
from typing import Any
|
2
|
+
|
3
|
+
from universal_mcp.applications import APIApplication
|
4
|
+
from universal_mcp.integrations import Integration
|
5
|
+
|
6
|
+
|
7
|
+
class YoutubeApp(APIApplication):
|
8
|
+
def __init__(self, integration: Integration = None, **kwargs) -> None:
|
9
|
+
"""
|
10
|
+
Initializes an instance of a YouTube application integration.
|
11
|
+
|
12
|
+
Args:
|
13
|
+
integration: An optional Integration object to be used with the YouTube application integration.
|
14
|
+
kwargs: Additional keyword arguments to be passed to the parent class initializer.
|
15
|
+
|
16
|
+
Returns:
|
17
|
+
None
|
18
|
+
"""
|
19
|
+
super().__init__(name="youtube", integration=integration, **kwargs)
|
20
|
+
self.base_url = "https://www.googleapis.com/youtube/v3"
|
21
|
+
|
22
|
+
def get_jobs_job_reports(
|
23
|
+
self,
|
24
|
+
jobId,
|
25
|
+
createdAfter=None,
|
26
|
+
onBehalfOfContentOwner=None,
|
27
|
+
pageSize=None,
|
28
|
+
pageToken=None,
|
29
|
+
startTimeAtOrAfter=None,
|
30
|
+
startTimeBefore=None,
|
31
|
+
) -> Any:
|
32
|
+
"""
|
33
|
+
Retrieves job reports for a specific job based on provided filters and parameters.
|
34
|
+
|
35
|
+
Args:
|
36
|
+
self: The instance of the class on which the method is being called.
|
37
|
+
jobId: The unique identifier for the job whose reports are to be retrieved.
|
38
|
+
createdAfter: Optional; filter to include only reports created after this date (ISO 8601 format).
|
39
|
+
onBehalfOfContentOwner: Optional; for content owners wanting to access reports on behalf of another user.
|
40
|
+
pageSize: Optional; the maximum number of report entries to return per page.
|
41
|
+
pageToken: Optional; a token identifying the page of results to return.
|
42
|
+
startTimeAtOrAfter: Optional; filter to include only reports starting at or after this date-time (ISO 8601 format).
|
43
|
+
startTimeBefore: Optional; filter to include only reports with a start time before this date-time (ISO 8601 format).
|
44
|
+
|
45
|
+
Returns:
|
46
|
+
A JSON object containing the job reports matching the provided criteria.
|
47
|
+
"""
|
48
|
+
if jobId is None:
|
49
|
+
raise ValueError("Missing required parameter 'jobId'")
|
50
|
+
url = f"{self.base_url}/v1/jobs/{jobId}/reports"
|
51
|
+
query_params = {
|
52
|
+
k: v
|
53
|
+
for k, v in [
|
54
|
+
("createdAfter", createdAfter),
|
55
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
56
|
+
("pageSize", pageSize),
|
57
|
+
("pageToken", pageToken),
|
58
|
+
("startTimeAtOrAfter", startTimeAtOrAfter),
|
59
|
+
("startTimeBefore", startTimeBefore),
|
60
|
+
]
|
61
|
+
if v is not None
|
62
|
+
}
|
63
|
+
response = self._get(url, params=query_params)
|
64
|
+
response.raise_for_status()
|
65
|
+
return response.json()
|
66
|
+
|
67
|
+
def get_jobs_job_reports_report(
|
68
|
+
self, jobId, reportId, onBehalfOfContentOwner=None
|
69
|
+
) -> Any:
|
70
|
+
"""
|
71
|
+
Retrieves a report for a specified job using the jobId and reportId.
|
72
|
+
|
73
|
+
Args:
|
74
|
+
self: The instance of the class on which this method is called.
|
75
|
+
jobId: The unique identifier for the job associated with the report.
|
76
|
+
reportId: The unique identifier for the report to retrieve.
|
77
|
+
onBehalfOfContentOwner: Optional; if specified, the request is performed on behalf of the content owner associated with this parameter.
|
78
|
+
|
79
|
+
Returns:
|
80
|
+
A JSON object containing the details of the requested report.
|
81
|
+
"""
|
82
|
+
if jobId is None:
|
83
|
+
raise ValueError("Missing required parameter 'jobId'")
|
84
|
+
if reportId is None:
|
85
|
+
raise ValueError("Missing required parameter 'reportId'")
|
86
|
+
url = f"{self.base_url}/v1/jobs/{jobId}/reports/{reportId}"
|
87
|
+
query_params = {
|
88
|
+
k: v
|
89
|
+
for k, v in [("onBehalfOfContentOwner", onBehalfOfContentOwner)]
|
90
|
+
if v is not None
|
91
|
+
}
|
92
|
+
response = self._get(url, params=query_params)
|
93
|
+
response.raise_for_status()
|
94
|
+
return response.json()
|
95
|
+
|
96
|
+
def delete_jobs_job(self, jobId, onBehalfOfContentOwner=None) -> Any:
|
97
|
+
"""
|
98
|
+
Deletes a job with the specified job ID, optionally acting on behalf of a content owner.
|
99
|
+
|
100
|
+
Args:
|
101
|
+
jobId: The unique identifier of the job to be deleted. Must not be None.
|
102
|
+
onBehalfOfContentOwner: Optional. The ID of the content owner on whose behalf the request is made.
|
103
|
+
|
104
|
+
Returns:
|
105
|
+
Returns the JSON response of the delete operation as a Python dictionary.
|
106
|
+
"""
|
107
|
+
if jobId is None:
|
108
|
+
raise ValueError("Missing required parameter 'jobId'")
|
109
|
+
url = f"{self.base_url}/v1/jobs/{jobId}"
|
110
|
+
query_params = {
|
111
|
+
k: v
|
112
|
+
for k, v in [("onBehalfOfContentOwner", onBehalfOfContentOwner)]
|
113
|
+
if v is not None
|
114
|
+
}
|
115
|
+
response = self._delete(url, params=query_params)
|
116
|
+
response.raise_for_status()
|
117
|
+
return response.json()
|
118
|
+
|
119
|
+
def get_jobs(
|
120
|
+
self,
|
121
|
+
includeSystemManaged=None,
|
122
|
+
onBehalfOfContentOwner=None,
|
123
|
+
pageSize=None,
|
124
|
+
pageToken=None,
|
125
|
+
) -> Any:
|
126
|
+
"""
|
127
|
+
Retrieves a list of jobs from the server, optionally filtering by specified query parameters.
|
128
|
+
|
129
|
+
Args:
|
130
|
+
includeSystemManaged: Optional; a boolean indicating whether to include system managed jobs in the result.
|
131
|
+
onBehalfOfContentOwner: Optional; a string representing the content owner on behalf of which the request is made.
|
132
|
+
pageSize: Optional; an integer specifying the number of jobs to return per page.
|
133
|
+
pageToken: Optional; a string representing the token to specify the start of the page for paginated results.
|
134
|
+
|
135
|
+
Returns:
|
136
|
+
A JSON-decoded response containing the list of jobs and related metadata.
|
137
|
+
"""
|
138
|
+
url = f"{self.base_url}/v1/jobs"
|
139
|
+
query_params = {
|
140
|
+
k: v
|
141
|
+
for k, v in [
|
142
|
+
("includeSystemManaged", includeSystemManaged),
|
143
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
144
|
+
("pageSize", pageSize),
|
145
|
+
("pageToken", pageToken),
|
146
|
+
]
|
147
|
+
if v is not None
|
148
|
+
}
|
149
|
+
response = self._get(url, params=query_params)
|
150
|
+
response.raise_for_status()
|
151
|
+
return response.json()
|
152
|
+
|
153
|
+
def get_media_resource_name(self, resourceName) -> Any:
|
154
|
+
"""
|
155
|
+
Retrieves a media resource by name and returns its JSON representation.
|
156
|
+
|
157
|
+
Args:
|
158
|
+
resourceName: The name of the media resource to be retrieved. Cannot be None.
|
159
|
+
|
160
|
+
Returns:
|
161
|
+
The JSON representation of the media resource.
|
162
|
+
"""
|
163
|
+
if resourceName is None:
|
164
|
+
raise ValueError("Missing required parameter 'resourceName'")
|
165
|
+
url = f"{self.base_url}/v1/media/{resourceName}"
|
166
|
+
query_params = {}
|
167
|
+
response = self._get(url, params=query_params)
|
168
|
+
response.raise_for_status()
|
169
|
+
return response.json()
|
170
|
+
|
171
|
+
def get_reporttypes(
|
172
|
+
self,
|
173
|
+
includeSystemManaged=None,
|
174
|
+
onBehalfOfContentOwner=None,
|
175
|
+
pageSize=None,
|
176
|
+
pageToken=None,
|
177
|
+
) -> Any:
|
178
|
+
"""
|
179
|
+
Retrieves a list of report types from the API with optional filtering and pagination.
|
180
|
+
|
181
|
+
Args:
|
182
|
+
includeSystemManaged: Optional; a boolean flag indicating if system-managed report types should be included.
|
183
|
+
onBehalfOfContentOwner: Optional; a string that specifies the content owner for whom the user is acting on behalf of.
|
184
|
+
pageSize: Optional; an integer that defines the number of results to return per page.
|
185
|
+
pageToken: Optional; a string token that indicates a specific page of results to retrieve.
|
186
|
+
|
187
|
+
Returns:
|
188
|
+
A JSON object containing the list of report types available from the API.
|
189
|
+
"""
|
190
|
+
url = f"{self.base_url}/v1/reportTypes"
|
191
|
+
query_params = {
|
192
|
+
k: v
|
193
|
+
for k, v in [
|
194
|
+
("includeSystemManaged", includeSystemManaged),
|
195
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
196
|
+
("pageSize", pageSize),
|
197
|
+
("pageToken", pageToken),
|
198
|
+
]
|
199
|
+
if v is not None
|
200
|
+
}
|
201
|
+
response = self._get(url, params=query_params)
|
202
|
+
response.raise_for_status()
|
203
|
+
return response.json()
|
204
|
+
|
205
|
+
def delete_captions(
|
206
|
+
self, id=None, onBehalfOf=None, onBehalfOfContentOwner=None
|
207
|
+
) -> Any:
|
208
|
+
"""
|
209
|
+
Deletes captions from a specified resource.
|
210
|
+
|
211
|
+
Args:
|
212
|
+
id: Optional; the unique identifier for the caption resource to delete.
|
213
|
+
onBehalfOf: Optional; a parameter to identify the user for whom the request is made.
|
214
|
+
onBehalfOfContentOwner: Optional; a parameter to specify the content owner for whom the request is made.
|
215
|
+
|
216
|
+
Returns:
|
217
|
+
Returns the response JSON object after deleting the caption resource.
|
218
|
+
"""
|
219
|
+
url = f"{self.base_url}/captions"
|
220
|
+
query_params = {
|
221
|
+
k: v
|
222
|
+
for k, v in [
|
223
|
+
("id", id),
|
224
|
+
("onBehalfOf", onBehalfOf),
|
225
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
226
|
+
]
|
227
|
+
if v is not None
|
228
|
+
}
|
229
|
+
response = self._delete(url, params=query_params)
|
230
|
+
response.raise_for_status()
|
231
|
+
return response.json()
|
232
|
+
|
233
|
+
def get_captions(
|
234
|
+
self, id, onBehalfOf=None, onBehalfOfContentOwner=None, tfmt=None, tlang=None
|
235
|
+
) -> Any:
|
236
|
+
"""
|
237
|
+
Retrieves captions for a specified video by its ID, optionally allowing additional query customizations.
|
238
|
+
|
239
|
+
Args:
|
240
|
+
id: The unique identifier for the video whose captions are to be retrieved. This parameter is mandatory.
|
241
|
+
onBehalfOf: The ID of the user on whose behalf the request is made. Defaults to None.
|
242
|
+
onBehalfOfContentOwner: The ID of the content owner on whose behalf the request is made. Defaults to None.
|
243
|
+
tfmt: The format of the caption track, such as 'srt' or 'ttml'. Defaults to None.
|
244
|
+
tlang: The language of the caption track, specified as a language code. Defaults to None.
|
245
|
+
|
246
|
+
Returns:
|
247
|
+
A JSON object containing the captions data for the specified video.
|
248
|
+
"""
|
249
|
+
if id is None:
|
250
|
+
raise ValueError("Missing required parameter 'id'")
|
251
|
+
url = f"{self.base_url}/captions/{id}"
|
252
|
+
query_params = {
|
253
|
+
k: v
|
254
|
+
for k, v in [
|
255
|
+
("onBehalfOf", onBehalfOf),
|
256
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
257
|
+
("tfmt", tfmt),
|
258
|
+
("tlang", tlang),
|
259
|
+
]
|
260
|
+
if v is not None
|
261
|
+
}
|
262
|
+
response = self._get(url, params=query_params)
|
263
|
+
response.raise_for_status()
|
264
|
+
return response.json()
|
265
|
+
|
266
|
+
def delete_comments(self, id=None) -> Any:
|
267
|
+
"""
|
268
|
+
Deletes a comment or comments from the server based on the specified ID.
|
269
|
+
|
270
|
+
Args:
|
271
|
+
id: Optional ID of the comment to be deleted. If not provided, and based on implementation, all comments may be deleted.
|
272
|
+
|
273
|
+
Returns:
|
274
|
+
The JSON response from the server after attempting to delete the comment(s).
|
275
|
+
"""
|
276
|
+
url = f"{self.base_url}/comments"
|
277
|
+
query_params = {k: v for k, v in [("id", id)] if v is not None}
|
278
|
+
response = self._delete(url, params=query_params)
|
279
|
+
response.raise_for_status()
|
280
|
+
return response.json()
|
281
|
+
|
282
|
+
def add_comments_mark_as_spam(self, id=None) -> Any:
|
283
|
+
"""
|
284
|
+
Marks a comment as spam by sending a POST request to the specified API endpoint.
|
285
|
+
|
286
|
+
Args:
|
287
|
+
id: Optional; the unique identifier of the comment to be marked as spam. If not provided, no specific comment ID is included in the request parameters.
|
288
|
+
|
289
|
+
Returns:
|
290
|
+
The JSON response from the API containing the result of the mark-as-spam operation.
|
291
|
+
"""
|
292
|
+
url = f"{self.base_url}/comments/markAsSpam"
|
293
|
+
query_params = {k: v for k, v in [("id", id)] if v is not None}
|
294
|
+
response = self._post(url, data={}, params=query_params)
|
295
|
+
response.raise_for_status()
|
296
|
+
return response.json()
|
297
|
+
|
298
|
+
def add_comments_set_moderation_status(
|
299
|
+
self, banAuthor=None, id=None, moderationStatus=None
|
300
|
+
) -> Any:
|
301
|
+
"""
|
302
|
+
Sets the moderation status for a comment and optionally bans the author.
|
303
|
+
|
304
|
+
Args:
|
305
|
+
banAuthor: Optional; a boolean indicating whether to ban the author of the comment.
|
306
|
+
id: Optional; a string representing the unique identifier of the comment to be moderated.
|
307
|
+
moderationStatus: Optional; a string specifying the desired moderation status for the comment, such as 'approved', 'rejected', etc.
|
308
|
+
|
309
|
+
Returns:
|
310
|
+
A JSON object containing the response from the server after attempting to set the moderation status for the specified comment.
|
311
|
+
"""
|
312
|
+
url = f"{self.base_url}/comments/setModerationStatus"
|
313
|
+
query_params = {
|
314
|
+
k: v
|
315
|
+
for k, v in [
|
316
|
+
("banAuthor", banAuthor),
|
317
|
+
("id", id),
|
318
|
+
("moderationStatus", moderationStatus),
|
319
|
+
]
|
320
|
+
if v is not None
|
321
|
+
}
|
322
|
+
response = self._post(url, data={}, params=query_params)
|
323
|
+
response.raise_for_status()
|
324
|
+
return response.json()
|
325
|
+
|
326
|
+
def delete_live_broadcasts(
|
327
|
+
self, id=None, onBehalfOfContentOwner=None, onBehalfOfContentOwnerChannel=None
|
328
|
+
) -> Any:
|
329
|
+
"""
|
330
|
+
Deletes live broadcasts from a platform using specified query parameters.
|
331
|
+
|
332
|
+
Args:
|
333
|
+
id: Optional; The unique identifier for the live broadcast to delete.
|
334
|
+
onBehalfOfContentOwner: Optional; The content owner on whose behalf the API request is being made.
|
335
|
+
onBehalfOfContentOwnerChannel: Optional; The channel ID associated with the content owner.
|
336
|
+
|
337
|
+
Returns:
|
338
|
+
A JSON object containing the server's response to the delete request.
|
339
|
+
"""
|
340
|
+
url = f"{self.base_url}/liveBroadcasts"
|
341
|
+
query_params = {
|
342
|
+
k: v
|
343
|
+
for k, v in [
|
344
|
+
("id", id),
|
345
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
346
|
+
("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
|
347
|
+
]
|
348
|
+
if v is not None
|
349
|
+
}
|
350
|
+
response = self._delete(url, params=query_params)
|
351
|
+
response.raise_for_status()
|
352
|
+
return response.json()
|
353
|
+
|
354
|
+
def add_live_broadcasts_bind(
|
355
|
+
self,
|
356
|
+
id=None,
|
357
|
+
onBehalfOfContentOwner=None,
|
358
|
+
onBehalfOfContentOwnerChannel=None,
|
359
|
+
part=None,
|
360
|
+
streamId=None,
|
361
|
+
) -> Any:
|
362
|
+
"""
|
363
|
+
Binds a live broadcast to a stream on YouTube, using specified parameters to authenticate and identify the broadcast and stream.
|
364
|
+
|
365
|
+
Args:
|
366
|
+
id: Optional; str. The id of the live broadcast to bind.
|
367
|
+
onBehalfOfContentOwner: Optional; str. The YouTube CMS content owner on behalf of whom the operation is performed.
|
368
|
+
onBehalfOfContentOwnerChannel: Optional; str. The YouTube channel ID for which the live broadcast is operated, on behalf of a content owner.
|
369
|
+
part: Optional; str. The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include.
|
370
|
+
streamId: Optional; str. The id of the stream to which the live broadcast is to be bound.
|
371
|
+
|
372
|
+
Returns:
|
373
|
+
The JSON response object from the YouTube API after attempting to bind the live broadcast to the stream.
|
374
|
+
"""
|
375
|
+
url = f"{self.base_url}/liveBroadcasts/bind"
|
376
|
+
query_params = {
|
377
|
+
k: v
|
378
|
+
for k, v in [
|
379
|
+
("id", id),
|
380
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
381
|
+
("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
|
382
|
+
("part", part),
|
383
|
+
("streamId", streamId),
|
384
|
+
]
|
385
|
+
if v is not None
|
386
|
+
}
|
387
|
+
response = self._post(url, data={}, params=query_params)
|
388
|
+
response.raise_for_status()
|
389
|
+
return response.json()
|
390
|
+
|
391
|
+
def add_live_broadcasts_control(
|
392
|
+
self,
|
393
|
+
displaySlate=None,
|
394
|
+
id=None,
|
395
|
+
offsetTimeMs=None,
|
396
|
+
onBehalfOfContentOwner=None,
|
397
|
+
onBehalfOfContentOwnerChannel=None,
|
398
|
+
part=None,
|
399
|
+
walltime=None,
|
400
|
+
) -> Any:
|
401
|
+
"""
|
402
|
+
Controls a live broadcast by sending a POST request with specified parameters.
|
403
|
+
|
404
|
+
Args:
|
405
|
+
displaySlate: Optional; Specifies whether or not to show a slate during the broadcast.
|
406
|
+
id: Optional; The ID of the live broadcast to control.
|
407
|
+
offsetTimeMs: Optional; The offset time in milliseconds for the broadcast control action.
|
408
|
+
onBehalfOfContentOwner: Optional; Indicates that the request is made on behalf of a content owner.
|
409
|
+
onBehalfOfContentOwnerChannel: Optional; The channel owned by the content owner.
|
410
|
+
part: Optional; Specifies a comma-separated list of one or more broadcasts resource properties.
|
411
|
+
walltime: Optional; An RFC 3339 timestamp that represents the time at which the action takes place.
|
412
|
+
|
413
|
+
Returns:
|
414
|
+
The JSON response from the server after controlling the live broadcast.
|
415
|
+
"""
|
416
|
+
url = f"{self.base_url}/liveBroadcasts/control"
|
417
|
+
query_params = {
|
418
|
+
k: v
|
419
|
+
for k, v in [
|
420
|
+
("displaySlate", displaySlate),
|
421
|
+
("id", id),
|
422
|
+
("offsetTimeMs", offsetTimeMs),
|
423
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
424
|
+
("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
|
425
|
+
("part", part),
|
426
|
+
("walltime", walltime),
|
427
|
+
]
|
428
|
+
if v is not None
|
429
|
+
}
|
430
|
+
response = self._post(url, data={}, params=query_params)
|
431
|
+
response.raise_for_status()
|
432
|
+
return response.json()
|
433
|
+
|
434
|
+
def add_live_broadcasts_transition(
|
435
|
+
self,
|
436
|
+
broadcastStatus=None,
|
437
|
+
id=None,
|
438
|
+
onBehalfOfContentOwner=None,
|
439
|
+
onBehalfOfContentOwnerChannel=None,
|
440
|
+
part=None,
|
441
|
+
) -> Any:
|
442
|
+
"""
|
443
|
+
Transitions a live broadcast to a specified status for a given broadcast ID.
|
444
|
+
|
445
|
+
Args:
|
446
|
+
broadcastStatus: Optional; The status to which the live broadcast should be transitioned.
|
447
|
+
id: Optional; The unique identifier of the broadcast that needs to be transitioned.
|
448
|
+
onBehalfOfContentOwner: Optional; The YouTube content owner on whose behalf the API request is being made.
|
449
|
+
onBehalfOfContentOwnerChannel: Optional; The YouTube channel ID of the channel associated with the specified content owner.
|
450
|
+
part: Optional; A comma-separated list of one or more liveBroadcast resource properties that the API response will include.
|
451
|
+
|
452
|
+
Returns:
|
453
|
+
The JSON response from the API containing the details of the transitioned live broadcast.
|
454
|
+
"""
|
455
|
+
url = f"{self.base_url}/liveBroadcasts/transition"
|
456
|
+
query_params = {
|
457
|
+
k: v
|
458
|
+
for k, v in [
|
459
|
+
("broadcastStatus", broadcastStatus),
|
460
|
+
("id", id),
|
461
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
462
|
+
("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
|
463
|
+
("part", part),
|
464
|
+
]
|
465
|
+
if v is not None
|
466
|
+
}
|
467
|
+
response = self._post(url, data={}, params=query_params)
|
468
|
+
response.raise_for_status()
|
469
|
+
return response.json()
|
470
|
+
|
471
|
+
def delete_live_chat_bans(self, id=None) -> Any:
|
472
|
+
"""
|
473
|
+
Deletes a live chat ban identified by the given ID from the server.
|
474
|
+
|
475
|
+
Args:
|
476
|
+
id: Optional; The unique identifier of the live chat ban to be deleted. If None, no specific ban is targeted.
|
477
|
+
|
478
|
+
Returns:
|
479
|
+
The JSON response from the server after the delete operation, which may include details of the deletion.
|
480
|
+
"""
|
481
|
+
url = f"{self.base_url}/liveChat/bans"
|
482
|
+
query_params = {k: v for k, v in [("id", id)] if v is not None}
|
483
|
+
response = self._delete(url, params=query_params)
|
484
|
+
response.raise_for_status()
|
485
|
+
return response.json()
|
486
|
+
|
487
|
+
def delete_live_chat_messages(self, id=None) -> Any:
|
488
|
+
"""
|
489
|
+
Deletes live chat messages based on the specified message ID.
|
490
|
+
|
491
|
+
Args:
|
492
|
+
id: Optional; The identifier of the specific live chat message to be deleted. If not provided, it defaults to None.
|
493
|
+
|
494
|
+
Returns:
|
495
|
+
A JSON object containing the server's response to the deletion request. It includes details about the operation's success or failure.
|
496
|
+
"""
|
497
|
+
url = f"{self.base_url}/liveChat/messages"
|
498
|
+
query_params = {k: v for k, v in [("id", id)] if v is not None}
|
499
|
+
response = self._delete(url, params=query_params)
|
500
|
+
response.raise_for_status()
|
501
|
+
return response.json()
|
502
|
+
|
503
|
+
def delete_live_chat_moderators(self, id=None) -> Any:
|
504
|
+
"""
|
505
|
+
Deletes a live chat moderator by ID.
|
506
|
+
|
507
|
+
Args:
|
508
|
+
id: The ID of the live chat moderator to delete. If None, no moderator is deleted.
|
509
|
+
|
510
|
+
Returns:
|
511
|
+
The JSON response from the server after attempting to delete the moderator.
|
512
|
+
"""
|
513
|
+
url = f"{self.base_url}/liveChat/moderators"
|
514
|
+
query_params = {k: v for k, v in [("id", id)] if v is not None}
|
515
|
+
response = self._delete(url, params=query_params)
|
516
|
+
response.raise_for_status()
|
517
|
+
return response.json()
|
518
|
+
|
519
|
+
def delete_videos(self, id=None, onBehalfOfContentOwner=None) -> Any:
|
520
|
+
"""
|
521
|
+
Deletes videos based on specified criteria from a video platform.
|
522
|
+
|
523
|
+
Args:
|
524
|
+
id: Optional; A string representing the unique identifier of the video to be deleted. If not provided, no video ID will be specified for deletion.
|
525
|
+
onBehalfOfContentOwner: Optional; A string representing the content owner on whose behalf the operation is being performed. If omitted, the operation is performed on behalf of the authenticated user.
|
526
|
+
|
527
|
+
Returns:
|
528
|
+
Returns a JSON object containing the response from the API after attempting to delete the video(s), including any relevant status or error information.
|
529
|
+
"""
|
530
|
+
url = f"{self.base_url}/videos"
|
531
|
+
query_params = {
|
532
|
+
k: v
|
533
|
+
for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
|
534
|
+
if v is not None
|
535
|
+
}
|
536
|
+
response = self._delete(url, params=query_params)
|
537
|
+
response.raise_for_status()
|
538
|
+
return response.json()
|
539
|
+
|
540
|
+
def get_videos_get_rating(self, id=None, onBehalfOfContentOwner=None) -> Any:
|
541
|
+
"""
|
542
|
+
Retrieves the rating of a video using video ID and optional content owner specification.
|
543
|
+
|
544
|
+
Args:
|
545
|
+
id: Optional; The ID of the video for which the rating is to be retrieved. If None, no specific video ID is used in the request.
|
546
|
+
onBehalfOfContentOwner: Optional; Identifies the content owner for whom the request is being made. Used for API requests made on behalf of a content owner.
|
547
|
+
|
548
|
+
Returns:
|
549
|
+
A JSON object containing the video rating information returned by the API.
|
550
|
+
"""
|
551
|
+
url = f"{self.base_url}/videos/getRating"
|
552
|
+
query_params = {
|
553
|
+
k: v
|
554
|
+
for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
|
555
|
+
if v is not None
|
556
|
+
}
|
557
|
+
response = self._get(url, params=query_params)
|
558
|
+
response.raise_for_status()
|
559
|
+
return response.json()
|
560
|
+
|
561
|
+
def add_videos_rate(self, id=None, rating=None) -> Any:
|
562
|
+
"""
|
563
|
+
Submit a rating for a video on the server using the provided video ID and rating value.
|
564
|
+
|
565
|
+
Args:
|
566
|
+
id: Optional; The unique identifier of the video to rate. If None, the video ID is not included in the request.
|
567
|
+
rating: Optional; The rating value to assign to the video. If None, the rating is not included in the request.
|
568
|
+
|
569
|
+
Returns:
|
570
|
+
The JSON response from the server after submitting the rating.
|
571
|
+
"""
|
572
|
+
url = f"{self.base_url}/videos/rate"
|
573
|
+
query_params = {
|
574
|
+
k: v for k, v in [("id", id), ("rating", rating)] if v is not None
|
575
|
+
}
|
576
|
+
response = self._post(url, data={}, params=query_params)
|
577
|
+
response.raise_for_status()
|
578
|
+
return response.json()
|
579
|
+
|
580
|
+
def add_videos_report_abuse(self, onBehalfOfContentOwner=None) -> Any:
|
581
|
+
"""
|
582
|
+
Sends a report to YouTube indicating a video's potential abuse.
|
583
|
+
|
584
|
+
Args:
|
585
|
+
self: The instance of the class containing this method.
|
586
|
+
onBehalfOfContentOwner: Optional; The YouTube content owner on whose behalf the abuse report is being sent.
|
587
|
+
|
588
|
+
Returns:
|
589
|
+
The JSON response from the YouTube API after reporting the abuse.
|
590
|
+
"""
|
591
|
+
url = f"{self.base_url}/videos/reportAbuse"
|
592
|
+
query_params = {
|
593
|
+
k: v
|
594
|
+
for k, v in [("onBehalfOfContentOwner", onBehalfOfContentOwner)]
|
595
|
+
if v is not None
|
596
|
+
}
|
597
|
+
response = self._post(url, data={}, params=query_params)
|
598
|
+
response.raise_for_status()
|
599
|
+
return response.json()
|
600
|
+
|
601
|
+
def add_watermarks_set(self, channelId=None, onBehalfOfContentOwner=None) -> Any:
|
602
|
+
"""
|
603
|
+
Sets watermarks on a specified YouTube channel using optional content owner credentials.
|
604
|
+
|
605
|
+
Args:
|
606
|
+
channelId: Optional; The ID of the YouTube channel on which to set the watermark.
|
607
|
+
onBehalfOfContentOwner: Optional; The content owner's ID that the request is made on behalf of, allowing authenticated channel actions.
|
608
|
+
|
609
|
+
Returns:
|
610
|
+
The JSON response from the API call, which includes details about the watermark setting operation.
|
611
|
+
"""
|
612
|
+
url = f"{self.base_url}/watermarks/set"
|
613
|
+
query_params = {
|
614
|
+
k: v
|
615
|
+
for k, v in [
|
616
|
+
("channelId", channelId),
|
617
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
618
|
+
]
|
619
|
+
if v is not None
|
620
|
+
}
|
621
|
+
response = self._post(url, data={}, params=query_params)
|
622
|
+
response.raise_for_status()
|
623
|
+
return response.json()
|
624
|
+
|
625
|
+
def add_watermarks_unset(self, channelId=None, onBehalfOfContentOwner=None) -> Any:
|
626
|
+
"""
|
627
|
+
Removes watermarks from a YouTube channel specified by channel ID.
|
628
|
+
|
629
|
+
Args:
|
630
|
+
channelId: Optional; The unique identifier of the YouTube channel from which to remove watermarks.
|
631
|
+
onBehalfOfContentOwner: Optional; The content owner that the request is on behalf of, used by YouTube content partners.
|
632
|
+
|
633
|
+
Returns:
|
634
|
+
The JSON response from the YouTube API after attempting to remove the watermarks.
|
635
|
+
"""
|
636
|
+
url = f"{self.base_url}/watermarks/unset"
|
637
|
+
query_params = {
|
638
|
+
k: v
|
639
|
+
for k, v in [
|
640
|
+
("channelId", channelId),
|
641
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
642
|
+
]
|
643
|
+
if v is not None
|
644
|
+
}
|
645
|
+
response = self._post(url, data={}, params=query_params)
|
646
|
+
response.raise_for_status()
|
647
|
+
return response.json()
|
648
|
+
|
649
|
+
def get_activities(
|
650
|
+
self,
|
651
|
+
channelId=None,
|
652
|
+
home=None,
|
653
|
+
maxResults=None,
|
654
|
+
mine=None,
|
655
|
+
pageToken=None,
|
656
|
+
part=None,
|
657
|
+
publishedAfter=None,
|
658
|
+
publishedBefore=None,
|
659
|
+
regionCode=None,
|
660
|
+
) -> Any:
|
661
|
+
"""
|
662
|
+
Get YouTube channel activities.
|
663
|
+
|
664
|
+
Args:
|
665
|
+
channelId: Channel ID
|
666
|
+
home: User's feed
|
667
|
+
maxResults: Results limit
|
668
|
+
mine: User's activities
|
669
|
+
pageToken: Page token
|
670
|
+
part: Response parts
|
671
|
+
publishedAfter: After date
|
672
|
+
publishedBefore: Before date
|
673
|
+
regionCode: Region code
|
674
|
+
|
675
|
+
Returns:
|
676
|
+
JSON with activities
|
677
|
+
"""
|
678
|
+
url = f"{self.base_url}/activities"
|
679
|
+
query_params = {
|
680
|
+
k: v
|
681
|
+
for k, v in [
|
682
|
+
("channelId", channelId),
|
683
|
+
("home", home),
|
684
|
+
("maxResults", maxResults),
|
685
|
+
("mine", mine),
|
686
|
+
("pageToken", pageToken),
|
687
|
+
("part", part),
|
688
|
+
("publishedAfter", publishedAfter),
|
689
|
+
("publishedBefore", publishedBefore),
|
690
|
+
("regionCode", regionCode),
|
691
|
+
]
|
692
|
+
if v is not None
|
693
|
+
}
|
694
|
+
response = self._get(url, params=query_params)
|
695
|
+
response.raise_for_status()
|
696
|
+
return response.json()
|
697
|
+
|
698
|
+
def add_channel_banners_insert(
|
699
|
+
self, channelId=None, onBehalfOfContentOwner=None
|
700
|
+
) -> Any:
|
701
|
+
"""
|
702
|
+
Inserts a new channel banner for a specified YouTube channel using YouTube Data API.
|
703
|
+
|
704
|
+
Args:
|
705
|
+
channelId: Optional; A string representing the unique identifier of the YouTube channel for which the banner is being inserted.
|
706
|
+
onBehalfOfContentOwner: Optional; A string indicating that the request is on behalf of an authenticated content owner and specifies the content owner's external ID.
|
707
|
+
|
708
|
+
Returns:
|
709
|
+
A JSON object containing the response from the YouTube Data API with details about the newly inserted channel banner.
|
710
|
+
"""
|
711
|
+
url = f"{self.base_url}/channelBanners/insert"
|
712
|
+
query_params = {
|
713
|
+
k: v
|
714
|
+
for k, v in [
|
715
|
+
("channelId", channelId),
|
716
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
717
|
+
]
|
718
|
+
if v is not None
|
719
|
+
}
|
720
|
+
response = self._post(url, data={}, params=query_params)
|
721
|
+
response.raise_for_status()
|
722
|
+
return response.json()
|
723
|
+
|
724
|
+
def delete_channel_sections(self, id=None, onBehalfOfContentOwner=None) -> Any:
|
725
|
+
"""
|
726
|
+
Deletes channel sections from a platform specified by the base URL.
|
727
|
+
|
728
|
+
Args:
|
729
|
+
id: Optional; A string representing the unique identifier of the channel section to be deleted.
|
730
|
+
onBehalfOfContentOwner: Optional; A string indicating that the request is being made on behalf of the content owner specified by this parameter.
|
731
|
+
|
732
|
+
Returns:
|
733
|
+
Returns a JSON-decoded response object from the server after attempting to delete the specified channel section.
|
734
|
+
"""
|
735
|
+
url = f"{self.base_url}/channelSections"
|
736
|
+
query_params = {
|
737
|
+
k: v
|
738
|
+
for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
|
739
|
+
if v is not None
|
740
|
+
}
|
741
|
+
response = self._delete(url, params=query_params)
|
742
|
+
response.raise_for_status()
|
743
|
+
return response.json()
|
744
|
+
|
745
|
+
def get_channels(
|
746
|
+
self,
|
747
|
+
categoryId=None,
|
748
|
+
forUsername=None,
|
749
|
+
hl=None,
|
750
|
+
id=None,
|
751
|
+
managedByMe=None,
|
752
|
+
maxResults=None,
|
753
|
+
mine=None,
|
754
|
+
mySubscribers=None,
|
755
|
+
onBehalfOfContentOwner=None,
|
756
|
+
pageToken=None,
|
757
|
+
part=None,
|
758
|
+
) -> Any:
|
759
|
+
"""
|
760
|
+
Get YouTube channels.
|
761
|
+
|
762
|
+
Args:
|
763
|
+
categoryId: Category ID
|
764
|
+
forUsername: Username
|
765
|
+
hl: Language code
|
766
|
+
id: Channel IDs
|
767
|
+
managedByMe: Managed channels
|
768
|
+
maxResults: Results limit
|
769
|
+
mine: Own channels
|
770
|
+
mySubscribers: Subscribed channels
|
771
|
+
onBehalfOfContentOwner: Owner ID
|
772
|
+
pageToken: Page token
|
773
|
+
part: Response parts
|
774
|
+
|
775
|
+
Returns:
|
776
|
+
JSON with channels
|
777
|
+
"""
|
778
|
+
url = f"{self.base_url}/channels"
|
779
|
+
query_params = {
|
780
|
+
k: v
|
781
|
+
for k, v in [
|
782
|
+
("categoryId", categoryId),
|
783
|
+
("forUsername", forUsername),
|
784
|
+
("hl", hl),
|
785
|
+
("id", id),
|
786
|
+
("managedByMe", managedByMe),
|
787
|
+
("maxResults", maxResults),
|
788
|
+
("mine", mine),
|
789
|
+
("mySubscribers", mySubscribers),
|
790
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
791
|
+
("pageToken", pageToken),
|
792
|
+
("part", part),
|
793
|
+
]
|
794
|
+
if v is not None
|
795
|
+
}
|
796
|
+
response = self._get(url, params=query_params)
|
797
|
+
response.raise_for_status()
|
798
|
+
return response.json()
|
799
|
+
|
800
|
+
def get_comment_threads(
|
801
|
+
self,
|
802
|
+
allThreadsRelatedToChannelId=None,
|
803
|
+
channelId=None,
|
804
|
+
id=None,
|
805
|
+
maxResults=None,
|
806
|
+
moderationStatus=None,
|
807
|
+
order=None,
|
808
|
+
pageToken=None,
|
809
|
+
part=None,
|
810
|
+
searchTerms=None,
|
811
|
+
textFormat=None,
|
812
|
+
videoId=None,
|
813
|
+
) -> Any:
|
814
|
+
"""
|
815
|
+
Get YouTube comment threads.
|
816
|
+
|
817
|
+
Args:
|
818
|
+
allThreadsRelatedToChannelId: Threads for channel
|
819
|
+
channelId: Channel ID
|
820
|
+
id: Comment thread IDs
|
821
|
+
maxResults: Results limit
|
822
|
+
moderationStatus: Moderation status
|
823
|
+
order: Sort order
|
824
|
+
pageToken: Pagination token
|
825
|
+
part: Response parts
|
826
|
+
searchTerms: Search terms
|
827
|
+
textFormat: Text format
|
828
|
+
videoId: Video ID
|
829
|
+
|
830
|
+
Returns:
|
831
|
+
JSON with comment threads
|
832
|
+
"""
|
833
|
+
url = f"{self.base_url}/commentThreads"
|
834
|
+
query_params = {
|
835
|
+
k: v
|
836
|
+
for k, v in [
|
837
|
+
("allThreadsRelatedToChannelId", allThreadsRelatedToChannelId),
|
838
|
+
("channelId", channelId),
|
839
|
+
("id", id),
|
840
|
+
("maxResults", maxResults),
|
841
|
+
("moderationStatus", moderationStatus),
|
842
|
+
("order", order),
|
843
|
+
("pageToken", pageToken),
|
844
|
+
("part", part),
|
845
|
+
("searchTerms", searchTerms),
|
846
|
+
("textFormat", textFormat),
|
847
|
+
("videoId", videoId),
|
848
|
+
]
|
849
|
+
if v is not None
|
850
|
+
}
|
851
|
+
response = self._get(url, params=query_params)
|
852
|
+
response.raise_for_status()
|
853
|
+
return response.json()
|
854
|
+
|
855
|
+
def get_fanfundingevents(
|
856
|
+
self, hl=None, maxResults=None, pageToken=None, part=None
|
857
|
+
) -> Any:
|
858
|
+
"""
|
859
|
+
Retrieves fan funding events based on specified filter criteria.
|
860
|
+
|
861
|
+
Args:
|
862
|
+
hl: Optional; a string representing the language for text values. If not specified, the default language will be used.
|
863
|
+
maxResults: Optional; an integer specifying the maximum number of results to return. If not specified, a server-determined default will be used.
|
864
|
+
pageToken: Optional; a string token to retrieve a specific page in a paginated set of results. Useful for navigating through large sets of data.
|
865
|
+
part: Optional; a comma-separated list of one or more 'fanFundingEvent' resource properties that the API response will include.
|
866
|
+
|
867
|
+
Returns:
|
868
|
+
The function returns the JSON-decoded response of the fan funding events data retrieved from the API.
|
869
|
+
"""
|
870
|
+
url = f"{self.base_url}/fanFundingEvents"
|
871
|
+
query_params = {
|
872
|
+
k: v
|
873
|
+
for k, v in [
|
874
|
+
("hl", hl),
|
875
|
+
("maxResults", maxResults),
|
876
|
+
("pageToken", pageToken),
|
877
|
+
("part", part),
|
878
|
+
]
|
879
|
+
if v is not None
|
880
|
+
}
|
881
|
+
response = self._get(url, params=query_params)
|
882
|
+
response.raise_for_status()
|
883
|
+
return response.json()
|
884
|
+
|
885
|
+
def get_guecategories(self, hl=None, id=None, part=None, regionCode=None) -> Any:
|
886
|
+
"""
|
887
|
+
Fetches guide categories from a remote service based on specified parameters.
|
888
|
+
|
889
|
+
Args:
|
890
|
+
hl: Optional; a string that specifies the language localization.
|
891
|
+
id: Optional; a string representing the ID of the guide category.
|
892
|
+
part: Optional; a string indicating which parts of the guide category resource to return.
|
893
|
+
regionCode: Optional; a string that denotes the region of interest.
|
894
|
+
|
895
|
+
Returns:
|
896
|
+
A dictionary containing the JSON response representing guide categories from the service.
|
897
|
+
"""
|
898
|
+
url = f"{self.base_url}/guideCategories"
|
899
|
+
query_params = {
|
900
|
+
k: v
|
901
|
+
for k, v in [
|
902
|
+
("hl", hl),
|
903
|
+
("id", id),
|
904
|
+
("part", part),
|
905
|
+
("regionCode", regionCode),
|
906
|
+
]
|
907
|
+
if v is not None
|
908
|
+
}
|
909
|
+
response = self._get(url, params=query_params)
|
910
|
+
response.raise_for_status()
|
911
|
+
return response.json()
|
912
|
+
|
913
|
+
def get_languages(self, hl=None, part=None) -> Any:
|
914
|
+
"""
|
915
|
+
Fetches a list of supported languages from the internationalization API.
|
916
|
+
|
917
|
+
Args:
|
918
|
+
hl: Optional; The language code to localize the language names, e.g., 'en' for English.
|
919
|
+
part: Optional; The part parameter specifies a comma-separated list of one or more i18nLanguage resource properties that the API response will include.
|
920
|
+
|
921
|
+
Returns:
|
922
|
+
A JSON object containing the API response with the list of supported languages.
|
923
|
+
"""
|
924
|
+
url = f"{self.base_url}/i18nLanguages"
|
925
|
+
query_params = {k: v for k, v in [("hl", hl), ("part", part)] if v is not None}
|
926
|
+
response = self._get(url, params=query_params)
|
927
|
+
response.raise_for_status()
|
928
|
+
return response.json()
|
929
|
+
|
930
|
+
def get_regions(self, hl=None, part=None) -> Any:
|
931
|
+
"""
|
932
|
+
Retrieves a list of i18n regions from a specified API endpoint.
|
933
|
+
|
934
|
+
Args:
|
935
|
+
hl: Optional; a string representing the language code for which the regions are requested.
|
936
|
+
part: Optional; a string specifying a comma-separated list of one or more i18nRegion resource parts to include in the API response.
|
937
|
+
|
938
|
+
Returns:
|
939
|
+
The JSON response from the API containing the list of i18n regions.
|
940
|
+
"""
|
941
|
+
url = f"{self.base_url}/i18nRegions"
|
942
|
+
query_params = {k: v for k, v in [("hl", hl), ("part", part)] if v is not None}
|
943
|
+
response = self._get(url, params=query_params)
|
944
|
+
response.raise_for_status()
|
945
|
+
return response.json()
|
946
|
+
|
947
|
+
def delete_livestreams(
|
948
|
+
self, id=None, onBehalfOfContentOwner=None, onBehalfOfContentOwnerChannel=None
|
949
|
+
) -> Any:
|
950
|
+
"""
|
951
|
+
Deletes a livestream resource from the YouTube Data API using optional filtering parameters.
|
952
|
+
|
953
|
+
Args:
|
954
|
+
id: Optional; A comma-separated list of YouTube livestream IDs that identify the resources to be deleted.
|
955
|
+
onBehalfOfContentOwner: Optional; YouTube content owner who is channel owner of the livestream and makes this API call.
|
956
|
+
onBehalfOfContentOwnerChannel: Optional; The YouTube channel ID on behalf of which the API call is being made.
|
957
|
+
|
958
|
+
Returns:
|
959
|
+
A JSON object containing the API's response to the delete request.
|
960
|
+
"""
|
961
|
+
url = f"{self.base_url}/liveStreams"
|
962
|
+
query_params = {
|
963
|
+
k: v
|
964
|
+
for k, v in [
|
965
|
+
("id", id),
|
966
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
967
|
+
("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
|
968
|
+
]
|
969
|
+
if v is not None
|
970
|
+
}
|
971
|
+
response = self._delete(url, params=query_params)
|
972
|
+
response.raise_for_status()
|
973
|
+
return response.json()
|
974
|
+
|
975
|
+
def delete_play_list_items(self, id=None, onBehalfOfContentOwner=None) -> Any:
|
976
|
+
"""
|
977
|
+
Deletes playlist items identified by the given id or on behalf of the specified content owner.
|
978
|
+
|
979
|
+
Args:
|
980
|
+
id: Optional; The ID of the playlist item to be deleted.
|
981
|
+
onBehalfOfContentOwner: Optional; The content owner on whose behalf the playlist item is being deleted.
|
982
|
+
|
983
|
+
Returns:
|
984
|
+
The JSON response from the server indicating the result of the deletion operation.
|
985
|
+
"""
|
986
|
+
url = f"{self.base_url}/playlistItems"
|
987
|
+
query_params = {
|
988
|
+
k: v
|
989
|
+
for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
|
990
|
+
if v is not None
|
991
|
+
}
|
992
|
+
response = self._delete(url, params=query_params)
|
993
|
+
response.raise_for_status()
|
994
|
+
return response.json()
|
995
|
+
|
996
|
+
def delete_playlists(self, id=None, onBehalfOfContentOwner=None) -> Any:
|
997
|
+
"""
|
998
|
+
Deletes playlists based on specified criteria.
|
999
|
+
|
1000
|
+
Args:
|
1001
|
+
id: Optional; A string representing the ID of the playlist to delete. Default is None.
|
1002
|
+
onBehalfOfContentOwner: Optional; A string representing the content owner in whose behalf the operation is being performed. Default is None.
|
1003
|
+
|
1004
|
+
Returns:
|
1005
|
+
The JSON response from the server as a result of the delete operation.
|
1006
|
+
"""
|
1007
|
+
url = f"{self.base_url}/playlists"
|
1008
|
+
query_params = {
|
1009
|
+
k: v
|
1010
|
+
for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
|
1011
|
+
if v is not None
|
1012
|
+
}
|
1013
|
+
response = self._delete(url, params=query_params)
|
1014
|
+
response.raise_for_status()
|
1015
|
+
return response.json()
|
1016
|
+
|
1017
|
+
def get_search(
|
1018
|
+
self,
|
1019
|
+
channelId=None,
|
1020
|
+
channelType=None,
|
1021
|
+
eventType=None,
|
1022
|
+
forContentOwner=None,
|
1023
|
+
forDeveloper=None,
|
1024
|
+
forMine=None,
|
1025
|
+
location=None,
|
1026
|
+
locationRadius=None,
|
1027
|
+
maxResults=None,
|
1028
|
+
onBehalfOfContentOwner=None,
|
1029
|
+
order=None,
|
1030
|
+
pageToken=None,
|
1031
|
+
part=None,
|
1032
|
+
publishedAfter=None,
|
1033
|
+
publishedBefore=None,
|
1034
|
+
q=None,
|
1035
|
+
regionCode=None,
|
1036
|
+
relatedToVideoId=None,
|
1037
|
+
relevanceLanguage=None,
|
1038
|
+
safeSearch=None,
|
1039
|
+
topicId=None,
|
1040
|
+
type=None,
|
1041
|
+
videoCaption=None,
|
1042
|
+
videoCategoryId=None,
|
1043
|
+
videoDefinition=None,
|
1044
|
+
videoDimension=None,
|
1045
|
+
videoDuration=None,
|
1046
|
+
videoEmbeddable=None,
|
1047
|
+
videoLicense=None,
|
1048
|
+
videoSyndicated=None,
|
1049
|
+
videoType=None,
|
1050
|
+
) -> Any:
|
1051
|
+
"""
|
1052
|
+
Search YouTube Data API with filters.
|
1053
|
+
|
1054
|
+
Args:
|
1055
|
+
channelId: Channel filter
|
1056
|
+
channelType: Channel type
|
1057
|
+
eventType: Event type
|
1058
|
+
forContentOwner: Content owner search
|
1059
|
+
forDeveloper: Developer search
|
1060
|
+
forMine: User's videos
|
1061
|
+
location: Location filter
|
1062
|
+
locationRadius: Location radius
|
1063
|
+
maxResults: Results limit
|
1064
|
+
onBehalfOfContentOwner: Owner ID
|
1065
|
+
order: Results order
|
1066
|
+
pageToken: Page token
|
1067
|
+
part: Response parts
|
1068
|
+
publishedAfter: After date
|
1069
|
+
publishedBefore: Before date
|
1070
|
+
q: Search query
|
1071
|
+
regionCode: Region code
|
1072
|
+
relatedToVideoId: Related videos
|
1073
|
+
relevanceLanguage: Language
|
1074
|
+
safeSearch: Safe search
|
1075
|
+
topicId: Topic filter
|
1076
|
+
type: Resource type
|
1077
|
+
videoCaption: Caption filter
|
1078
|
+
videoCategoryId: Category
|
1079
|
+
videoDefinition: Definition
|
1080
|
+
videoDimension: Dimension
|
1081
|
+
videoDuration: Duration
|
1082
|
+
videoEmbeddable: Embeddable
|
1083
|
+
videoLicense: License
|
1084
|
+
videoSyndicated: Syndicated
|
1085
|
+
videoType: Video type
|
1086
|
+
|
1087
|
+
Returns:
|
1088
|
+
JSON with search results
|
1089
|
+
"""
|
1090
|
+
url = f"{self.base_url}/search"
|
1091
|
+
query_params = {
|
1092
|
+
k: v
|
1093
|
+
for k, v in [
|
1094
|
+
("channelId", channelId),
|
1095
|
+
("channelType", channelType),
|
1096
|
+
("eventType", eventType),
|
1097
|
+
("forContentOwner", forContentOwner),
|
1098
|
+
("forDeveloper", forDeveloper),
|
1099
|
+
("forMine", forMine),
|
1100
|
+
("location", location),
|
1101
|
+
("locationRadius", locationRadius),
|
1102
|
+
("maxResults", maxResults),
|
1103
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
1104
|
+
("order", order),
|
1105
|
+
("pageToken", pageToken),
|
1106
|
+
("part", part),
|
1107
|
+
("publishedAfter", publishedAfter),
|
1108
|
+
("publishedBefore", publishedBefore),
|
1109
|
+
("q", q),
|
1110
|
+
("regionCode", regionCode),
|
1111
|
+
("relatedToVideoId", relatedToVideoId),
|
1112
|
+
("relevanceLanguage", relevanceLanguage),
|
1113
|
+
("safeSearch", safeSearch),
|
1114
|
+
("topicId", topicId),
|
1115
|
+
("type", type),
|
1116
|
+
("videoCaption", videoCaption),
|
1117
|
+
("videoCategoryId", videoCategoryId),
|
1118
|
+
("videoDefinition", videoDefinition),
|
1119
|
+
("videoDimension", videoDimension),
|
1120
|
+
("videoDuration", videoDuration),
|
1121
|
+
("videoEmbeddable", videoEmbeddable),
|
1122
|
+
("videoLicense", videoLicense),
|
1123
|
+
("videoSyndicated", videoSyndicated),
|
1124
|
+
("videoType", videoType),
|
1125
|
+
]
|
1126
|
+
if v is not None
|
1127
|
+
}
|
1128
|
+
response = self._get(url, params=query_params)
|
1129
|
+
response.raise_for_status()
|
1130
|
+
return response.json()
|
1131
|
+
|
1132
|
+
def get_sponsors(
|
1133
|
+
self, filter=None, maxResults=None, pageToken=None, part=None
|
1134
|
+
) -> Any:
|
1135
|
+
"""
|
1136
|
+
Fetches a list of sponsors from a server, applying optional filtering and pagination.
|
1137
|
+
|
1138
|
+
Args:
|
1139
|
+
filter: Optional; A string containing filtering criteria for the sponsors.
|
1140
|
+
maxResults: Optional; An integer limiting the number of sponsors returned.
|
1141
|
+
pageToken: Optional; A token string used to retrieve a specific page of results.
|
1142
|
+
part: Optional; A string specifying which parts of the sponsor details to fetch.
|
1143
|
+
|
1144
|
+
Returns:
|
1145
|
+
The JSON response containing the list of sponsors, potentially filtered and paginated, as returned by the server.
|
1146
|
+
"""
|
1147
|
+
url = f"{self.base_url}/sponsors"
|
1148
|
+
query_params = {
|
1149
|
+
k: v
|
1150
|
+
for k, v in [
|
1151
|
+
("filter", filter),
|
1152
|
+
("maxResults", maxResults),
|
1153
|
+
("pageToken", pageToken),
|
1154
|
+
("part", part),
|
1155
|
+
]
|
1156
|
+
if v is not None
|
1157
|
+
}
|
1158
|
+
response = self._get(url, params=query_params)
|
1159
|
+
response.raise_for_status()
|
1160
|
+
return response.json()
|
1161
|
+
|
1162
|
+
def delete_subscriptions(self, id=None) -> Any:
|
1163
|
+
"""
|
1164
|
+
Deletes subscriptions by sending a DELETE request to the API.
|
1165
|
+
|
1166
|
+
Args:
|
1167
|
+
id: Optional; An identifier for a specific subscription to delete. If None, deletes all subscriptions.
|
1168
|
+
|
1169
|
+
Returns:
|
1170
|
+
The JSON response from the API after attempting to delete the subscription(s).
|
1171
|
+
"""
|
1172
|
+
url = f"{self.base_url}/subscriptions"
|
1173
|
+
query_params = {k: v for k, v in [("id", id)] if v is not None}
|
1174
|
+
response = self._delete(url, params=query_params)
|
1175
|
+
response.raise_for_status()
|
1176
|
+
return response.json()
|
1177
|
+
|
1178
|
+
def get_superchatevents(
|
1179
|
+
self, hl=None, maxResults=None, pageToken=None, part=None
|
1180
|
+
) -> Any:
|
1181
|
+
"""
|
1182
|
+
Fetches a list of super chat events from the YouTube API with optional filtering parameters.
|
1183
|
+
|
1184
|
+
Args:
|
1185
|
+
hl: Optional; the language code to select localized resource information.
|
1186
|
+
maxResults: Optional; the maximum number of items that should be returned in the result set.
|
1187
|
+
pageToken: Optional; the token to identify a specific page in the result set.
|
1188
|
+
part: Optional; the parameter specifying which super chat event resource parts to include in the response.
|
1189
|
+
|
1190
|
+
Returns:
|
1191
|
+
A JSON object containing the super chat events data returned by the YouTube API.
|
1192
|
+
"""
|
1193
|
+
url = f"{self.base_url}/superChatEvents"
|
1194
|
+
query_params = {
|
1195
|
+
k: v
|
1196
|
+
for k, v in [
|
1197
|
+
("hl", hl),
|
1198
|
+
("maxResults", maxResults),
|
1199
|
+
("pageToken", pageToken),
|
1200
|
+
("part", part),
|
1201
|
+
]
|
1202
|
+
if v is not None
|
1203
|
+
}
|
1204
|
+
response = self._get(url, params=query_params)
|
1205
|
+
response.raise_for_status()
|
1206
|
+
return response.json()
|
1207
|
+
|
1208
|
+
def add_thumbnails_set(self, onBehalfOfContentOwner=None, videoId=None) -> Any:
|
1209
|
+
"""
|
1210
|
+
Sets a thumbnail for a specified video on behalf of a content owner using the YouTube API.
|
1211
|
+
|
1212
|
+
Args:
|
1213
|
+
onBehalfOfContentOwner: Optional; str. The YouTube content owner ID on whose behalf the request is being made.
|
1214
|
+
videoId: Optional; str. The ID of the video for which the thumbnails are being set.
|
1215
|
+
|
1216
|
+
Returns:
|
1217
|
+
dict. The response from the YouTube API as a JSON object, containing details of the updated video thumbnail.
|
1218
|
+
"""
|
1219
|
+
url = f"{self.base_url}/thumbnails/set"
|
1220
|
+
query_params = {
|
1221
|
+
k: v
|
1222
|
+
for k, v in [
|
1223
|
+
("onBehalfOfContentOwner", onBehalfOfContentOwner),
|
1224
|
+
("videoId", videoId),
|
1225
|
+
]
|
1226
|
+
if v is not None
|
1227
|
+
}
|
1228
|
+
response = self._post(url, data={}, params=query_params)
|
1229
|
+
response.raise_for_status()
|
1230
|
+
return response.json()
|
1231
|
+
|
1232
|
+
def get_video_abuse_report_reasons(self, hl=None, part=None) -> Any:
|
1233
|
+
"""
|
1234
|
+
Fetches a list of video abuse report reasons with optional localization and response filtering.
|
1235
|
+
|
1236
|
+
Args:
|
1237
|
+
hl: An optional parameter specifying the language for localizing the response. This is typically a BCP-47 language code, such as 'en' or 'fr'.
|
1238
|
+
part: An optional parameter specifying which parts of the abuse report reasons to include in the response. This could specify fields like 'id' or 'snippet'.
|
1239
|
+
|
1240
|
+
Returns:
|
1241
|
+
The function returns a JSON object containing the list of video abuse report reasons, or filtered parts of it, if specified.
|
1242
|
+
"""
|
1243
|
+
url = f"{self.base_url}/videoAbuseReportReasons"
|
1244
|
+
query_params = {k: v for k, v in [("hl", hl), ("part", part)] if v is not None}
|
1245
|
+
response = self._get(url, params=query_params)
|
1246
|
+
response.raise_for_status()
|
1247
|
+
return response.json()
|
1248
|
+
|
1249
|
+
def get_veocategories(self, hl=None, id=None, part=None, regionCode=None) -> Any:
|
1250
|
+
"""
|
1251
|
+
Fetches video categories from an external API using specified query parameters.
|
1252
|
+
|
1253
|
+
Args:
|
1254
|
+
hl: Optional; the language code for localized video category names, e.g., 'en'.
|
1255
|
+
id: Optional; a comma-separated list of video category IDs to filter the results.
|
1256
|
+
part: Optional; a list of properties to include in the response, e.g., 'snippet'.
|
1257
|
+
regionCode: Optional; an ISO 3166-1 alpha-2 country code to filter the categories for a specific region.
|
1258
|
+
|
1259
|
+
Returns:
|
1260
|
+
The JSON response from the API containing video category information.
|
1261
|
+
"""
|
1262
|
+
url = f"{self.base_url}/videoCategories"
|
1263
|
+
query_params = {
|
1264
|
+
k: v
|
1265
|
+
for k, v in [
|
1266
|
+
("hl", hl),
|
1267
|
+
("id", id),
|
1268
|
+
("part", part),
|
1269
|
+
("regionCode", regionCode),
|
1270
|
+
]
|
1271
|
+
if v is not None
|
1272
|
+
}
|
1273
|
+
response = self._get(url, params=query_params)
|
1274
|
+
response.raise_for_status()
|
1275
|
+
return response.json()
|
1276
|
+
|
1277
|
+
def delete_groupitems(self, id=None, onBehalfOfContentOwner=None) -> Any:
|
1278
|
+
"""
|
1279
|
+
Deletes group items based on specified parameters.
|
1280
|
+
|
1281
|
+
Args:
|
1282
|
+
id: Optional; A string that identifies the group item to be deleted. If not provided, all group items may be affected depending on other parameters.
|
1283
|
+
onBehalfOfContentOwner: Optional; A string representing the content owner on whose behalf the request is being made. This is typically used for partners or channels managed by the content owner.
|
1284
|
+
|
1285
|
+
Returns:
|
1286
|
+
A JSON object containing the response from the deletion request, which includes the results of the delete operation.
|
1287
|
+
"""
|
1288
|
+
url = f"{self.base_url}/groupItems"
|
1289
|
+
query_params = {
|
1290
|
+
k: v
|
1291
|
+
for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
|
1292
|
+
if v is not None
|
1293
|
+
}
|
1294
|
+
response = self._delete(url, params=query_params)
|
1295
|
+
response.raise_for_status()
|
1296
|
+
return response.json()
|
1297
|
+
|
1298
|
+
def delete_groups(self, id=None, onBehalfOfContentOwner=None) -> Any:
|
1299
|
+
"""
|
1300
|
+
Deletes groups specified by their ID, optionally on behalf of a content owner.
|
1301
|
+
|
1302
|
+
Args:
|
1303
|
+
id: Optional; The unique identifier for the group to be deleted. If not provided, no specific group ID will be targeted.
|
1304
|
+
onBehalfOfContentOwner: Optional; The content owner that the group deletion is being performed on behalf of.
|
1305
|
+
|
1306
|
+
Returns:
|
1307
|
+
A JSON-decoded response from the server indicating the success or failure of the delete operation.
|
1308
|
+
"""
|
1309
|
+
url = f"{self.base_url}/groups"
|
1310
|
+
query_params = {
|
1311
|
+
k: v
|
1312
|
+
for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
|
1313
|
+
if v is not None
|
1314
|
+
}
|
1315
|
+
response = self._delete(url, params=query_params)
|
1316
|
+
response.raise_for_status()
|
1317
|
+
return response.json()
|
1318
|
+
|
1319
|
+
def get_reports(
|
1320
|
+
self,
|
1321
|
+
currency=None,
|
1322
|
+
dimensions=None,
|
1323
|
+
end=None,
|
1324
|
+
filters=None,
|
1325
|
+
ids=None,
|
1326
|
+
include=None,
|
1327
|
+
max=None,
|
1328
|
+
metrics=None,
|
1329
|
+
sort=None,
|
1330
|
+
start=None,
|
1331
|
+
) -> Any:
|
1332
|
+
"""
|
1333
|
+
Fetches and returns report data based on specified filtering and sorting criteria.
|
1334
|
+
|
1335
|
+
Args:
|
1336
|
+
currency: Optional; Specifies the currency format for the report.
|
1337
|
+
dimensions: Optional; List of dimensions to include in the report.
|
1338
|
+
end: Optional; End date for the report data range.
|
1339
|
+
filters: Optional; Filters to apply to the report data.
|
1340
|
+
ids: Optional; Specific identifiers to include in the report.
|
1341
|
+
include: Optional; Additional entities to include in the report's output.
|
1342
|
+
max: Optional; Maximum number of results to return.
|
1343
|
+
metrics: Optional; List of metrics to include in the report.
|
1344
|
+
sort: Optional; Order by which to sort the report results.
|
1345
|
+
start: Optional; Start date for the report data range.
|
1346
|
+
|
1347
|
+
Returns:
|
1348
|
+
The response containing the report data in JSON format.
|
1349
|
+
"""
|
1350
|
+
url = f"{self.base_url}/reports"
|
1351
|
+
query_params = {
|
1352
|
+
k: v
|
1353
|
+
for k, v in [
|
1354
|
+
("currency", currency),
|
1355
|
+
("dimensions", dimensions),
|
1356
|
+
("end", end),
|
1357
|
+
("filters", filters),
|
1358
|
+
("ids", ids),
|
1359
|
+
("include", include),
|
1360
|
+
("max", max),
|
1361
|
+
("metrics", metrics),
|
1362
|
+
("sort", sort),
|
1363
|
+
("start", start),
|
1364
|
+
]
|
1365
|
+
if v is not None
|
1366
|
+
}
|
1367
|
+
response = self._get(url, params=query_params)
|
1368
|
+
response.raise_for_status()
|
1369
|
+
return response.json()
|
1370
|
+
|
1371
|
+
def list_tools(self):
|
1372
|
+
"""
|
1373
|
+
Returns a list of tool methods available in the class instance.
|
1374
|
+
|
1375
|
+
Args:
|
1376
|
+
None: This function does not accept any parameters.
|
1377
|
+
|
1378
|
+
Returns:
|
1379
|
+
list: A list containing references to various tool methods associated with job reports, media resources, comments, broadcasts, videos, activities, channels, etc.
|
1380
|
+
"""
|
1381
|
+
return [
|
1382
|
+
self.get_jobs_job_reports,
|
1383
|
+
self.get_jobs_job_reports_report,
|
1384
|
+
self.delete_jobs_job,
|
1385
|
+
self.get_jobs,
|
1386
|
+
self.get_media_resource_name,
|
1387
|
+
self.get_reporttypes,
|
1388
|
+
self.delete_captions,
|
1389
|
+
self.get_captions,
|
1390
|
+
self.delete_comments,
|
1391
|
+
self.add_comments_mark_as_spam,
|
1392
|
+
self.add_comments_set_moderation_status,
|
1393
|
+
self.delete_live_broadcasts,
|
1394
|
+
self.add_live_broadcasts_bind,
|
1395
|
+
self.add_live_broadcasts_control,
|
1396
|
+
self.add_live_broadcasts_transition,
|
1397
|
+
self.delete_live_chat_bans,
|
1398
|
+
self.delete_live_chat_messages,
|
1399
|
+
self.delete_live_chat_moderators,
|
1400
|
+
self.delete_videos,
|
1401
|
+
self.get_videos_get_rating,
|
1402
|
+
self.add_videos_rate,
|
1403
|
+
self.add_videos_report_abuse,
|
1404
|
+
self.add_watermarks_set,
|
1405
|
+
self.add_watermarks_unset,
|
1406
|
+
self.get_activities,
|
1407
|
+
self.add_channel_banners_insert,
|
1408
|
+
self.delete_channel_sections,
|
1409
|
+
self.get_channels,
|
1410
|
+
self.get_comment_threads,
|
1411
|
+
self.get_fanfundingevents,
|
1412
|
+
self.get_guecategories,
|
1413
|
+
self.get_languages,
|
1414
|
+
self.get_regions,
|
1415
|
+
self.delete_livestreams,
|
1416
|
+
self.delete_play_list_items,
|
1417
|
+
self.delete_playlists,
|
1418
|
+
self.get_search,
|
1419
|
+
self.get_sponsors,
|
1420
|
+
self.delete_subscriptions,
|
1421
|
+
self.get_superchatevents,
|
1422
|
+
self.add_thumbnails_set,
|
1423
|
+
self.get_video_abuse_report_reasons,
|
1424
|
+
self.get_veocategories,
|
1425
|
+
self.delete_groupitems,
|
1426
|
+
self.delete_groups,
|
1427
|
+
self.get_reports,
|
1428
|
+
]
|