universal-mcp-applications 0.1.1__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.
Files changed (268) hide show
  1. universal_mcp/applications/ahrefs/README.md +51 -0
  2. universal_mcp/applications/ahrefs/__init__.py +1 -0
  3. universal_mcp/applications/ahrefs/app.py +2291 -0
  4. universal_mcp/applications/airtable/README.md +22 -0
  5. universal_mcp/applications/airtable/__init__.py +1 -0
  6. universal_mcp/applications/airtable/app.py +479 -0
  7. universal_mcp/applications/apollo/README.md +44 -0
  8. universal_mcp/applications/apollo/__init__.py +1 -0
  9. universal_mcp/applications/apollo/app.py +1847 -0
  10. universal_mcp/applications/asana/README.md +199 -0
  11. universal_mcp/applications/asana/__init__.py +1 -0
  12. universal_mcp/applications/asana/app.py +9509 -0
  13. universal_mcp/applications/aws-s3/README.md +0 -0
  14. universal_mcp/applications/aws-s3/__init__.py +1 -0
  15. universal_mcp/applications/aws-s3/app.py +552 -0
  16. universal_mcp/applications/bill/README.md +0 -0
  17. universal_mcp/applications/bill/__init__.py +1 -0
  18. universal_mcp/applications/bill/app.py +8705 -0
  19. universal_mcp/applications/box/README.md +307 -0
  20. universal_mcp/applications/box/__init__.py +1 -0
  21. universal_mcp/applications/box/app.py +15987 -0
  22. universal_mcp/applications/braze/README.md +106 -0
  23. universal_mcp/applications/braze/__init__.py +1 -0
  24. universal_mcp/applications/braze/app.py +4754 -0
  25. universal_mcp/applications/cal-com-v2/README.md +150 -0
  26. universal_mcp/applications/cal-com-v2/__init__.py +1 -0
  27. universal_mcp/applications/cal-com-v2/app.py +5541 -0
  28. universal_mcp/applications/calendly/README.md +53 -0
  29. universal_mcp/applications/calendly/__init__.py +1 -0
  30. universal_mcp/applications/calendly/app.py +1436 -0
  31. universal_mcp/applications/canva/README.md +43 -0
  32. universal_mcp/applications/canva/__init__.py +1 -0
  33. universal_mcp/applications/canva/app.py +941 -0
  34. universal_mcp/applications/clickup/README.md +135 -0
  35. universal_mcp/applications/clickup/__init__.py +1 -0
  36. universal_mcp/applications/clickup/app.py +5009 -0
  37. universal_mcp/applications/coda/README.md +108 -0
  38. universal_mcp/applications/coda/__init__.py +1 -0
  39. universal_mcp/applications/coda/app.py +3671 -0
  40. universal_mcp/applications/confluence/README.md +198 -0
  41. universal_mcp/applications/confluence/__init__.py +1 -0
  42. universal_mcp/applications/confluence/app.py +6273 -0
  43. universal_mcp/applications/contentful/README.md +17 -0
  44. universal_mcp/applications/contentful/__init__.py +1 -0
  45. universal_mcp/applications/contentful/app.py +364 -0
  46. universal_mcp/applications/crustdata/README.md +25 -0
  47. universal_mcp/applications/crustdata/__init__.py +1 -0
  48. universal_mcp/applications/crustdata/app.py +586 -0
  49. universal_mcp/applications/dialpad/README.md +202 -0
  50. universal_mcp/applications/dialpad/__init__.py +1 -0
  51. universal_mcp/applications/dialpad/app.py +5949 -0
  52. universal_mcp/applications/digitalocean/README.md +463 -0
  53. universal_mcp/applications/digitalocean/__init__.py +1 -0
  54. universal_mcp/applications/digitalocean/app.py +20835 -0
  55. universal_mcp/applications/domain-checker/README.md +13 -0
  56. universal_mcp/applications/domain-checker/__init__.py +1 -0
  57. universal_mcp/applications/domain-checker/app.py +265 -0
  58. universal_mcp/applications/e2b/README.md +12 -0
  59. universal_mcp/applications/e2b/__init__.py +1 -0
  60. universal_mcp/applications/e2b/app.py +187 -0
  61. universal_mcp/applications/elevenlabs/README.md +88 -0
  62. universal_mcp/applications/elevenlabs/__init__.py +1 -0
  63. universal_mcp/applications/elevenlabs/app.py +3235 -0
  64. universal_mcp/applications/exa/README.md +15 -0
  65. universal_mcp/applications/exa/__init__.py +1 -0
  66. universal_mcp/applications/exa/app.py +221 -0
  67. universal_mcp/applications/falai/README.md +17 -0
  68. universal_mcp/applications/falai/__init__.py +1 -0
  69. universal_mcp/applications/falai/app.py +331 -0
  70. universal_mcp/applications/figma/README.md +49 -0
  71. universal_mcp/applications/figma/__init__.py +1 -0
  72. universal_mcp/applications/figma/app.py +1090 -0
  73. universal_mcp/applications/firecrawl/README.md +20 -0
  74. universal_mcp/applications/firecrawl/__init__.py +1 -0
  75. universal_mcp/applications/firecrawl/app.py +514 -0
  76. universal_mcp/applications/fireflies/README.md +25 -0
  77. universal_mcp/applications/fireflies/__init__.py +1 -0
  78. universal_mcp/applications/fireflies/app.py +506 -0
  79. universal_mcp/applications/fpl/README.md +23 -0
  80. universal_mcp/applications/fpl/__init__.py +1 -0
  81. universal_mcp/applications/fpl/app.py +1327 -0
  82. universal_mcp/applications/fpl/utils/api.py +142 -0
  83. universal_mcp/applications/fpl/utils/fixtures.py +629 -0
  84. universal_mcp/applications/fpl/utils/helper.py +982 -0
  85. universal_mcp/applications/fpl/utils/league_utils.py +546 -0
  86. universal_mcp/applications/fpl/utils/position_utils.py +68 -0
  87. universal_mcp/applications/ghost-content/README.md +25 -0
  88. universal_mcp/applications/ghost-content/__init__.py +1 -0
  89. universal_mcp/applications/ghost-content/app.py +654 -0
  90. universal_mcp/applications/github/README.md +1049 -0
  91. universal_mcp/applications/github/__init__.py +1 -0
  92. universal_mcp/applications/github/app.py +50600 -0
  93. universal_mcp/applications/gong/README.md +63 -0
  94. universal_mcp/applications/gong/__init__.py +1 -0
  95. universal_mcp/applications/gong/app.py +2297 -0
  96. universal_mcp/applications/google-ads/README.md +0 -0
  97. universal_mcp/applications/google-ads/__init__.py +1 -0
  98. universal_mcp/applications/google-ads/app.py +23 -0
  99. universal_mcp/applications/google-calendar/README.md +21 -0
  100. universal_mcp/applications/google-calendar/__init__.py +1 -0
  101. universal_mcp/applications/google-calendar/app.py +574 -0
  102. universal_mcp/applications/google-docs/README.md +25 -0
  103. universal_mcp/applications/google-docs/__init__.py +1 -0
  104. universal_mcp/applications/google-docs/app.py +760 -0
  105. universal_mcp/applications/google-drive/README.md +68 -0
  106. universal_mcp/applications/google-drive/__init__.py +1 -0
  107. universal_mcp/applications/google-drive/app.py +4936 -0
  108. universal_mcp/applications/google-gemini/README.md +25 -0
  109. universal_mcp/applications/google-gemini/__init__.py +1 -0
  110. universal_mcp/applications/google-gemini/app.py +663 -0
  111. universal_mcp/applications/google-mail/README.md +31 -0
  112. universal_mcp/applications/google-mail/__init__.py +1 -0
  113. universal_mcp/applications/google-mail/app.py +1354 -0
  114. universal_mcp/applications/google-searchconsole/README.md +21 -0
  115. universal_mcp/applications/google-searchconsole/__init__.py +1 -0
  116. universal_mcp/applications/google-searchconsole/app.py +320 -0
  117. universal_mcp/applications/google-sheet/README.md +36 -0
  118. universal_mcp/applications/google-sheet/__init__.py +1 -0
  119. universal_mcp/applications/google-sheet/app.py +1941 -0
  120. universal_mcp/applications/hashnode/README.md +20 -0
  121. universal_mcp/applications/hashnode/__init__.py +1 -0
  122. universal_mcp/applications/hashnode/app.py +455 -0
  123. universal_mcp/applications/heygen/README.md +44 -0
  124. universal_mcp/applications/heygen/__init__.py +1 -0
  125. universal_mcp/applications/heygen/app.py +961 -0
  126. universal_mcp/applications/http-tools/README.md +16 -0
  127. universal_mcp/applications/http-tools/__init__.py +1 -0
  128. universal_mcp/applications/http-tools/app.py +153 -0
  129. universal_mcp/applications/hubspot/README.md +239 -0
  130. universal_mcp/applications/hubspot/__init__.py +1 -0
  131. universal_mcp/applications/hubspot/app.py +416 -0
  132. universal_mcp/applications/jira/README.md +600 -0
  133. universal_mcp/applications/jira/__init__.py +1 -0
  134. universal_mcp/applications/jira/app.py +28804 -0
  135. universal_mcp/applications/klaviyo/README.md +313 -0
  136. universal_mcp/applications/klaviyo/__init__.py +1 -0
  137. universal_mcp/applications/klaviyo/app.py +11236 -0
  138. universal_mcp/applications/linkedin/README.md +15 -0
  139. universal_mcp/applications/linkedin/__init__.py +1 -0
  140. universal_mcp/applications/linkedin/app.py +243 -0
  141. universal_mcp/applications/mailchimp/README.md +281 -0
  142. universal_mcp/applications/mailchimp/__init__.py +1 -0
  143. universal_mcp/applications/mailchimp/app.py +10937 -0
  144. universal_mcp/applications/markitdown/README.md +12 -0
  145. universal_mcp/applications/markitdown/__init__.py +1 -0
  146. universal_mcp/applications/markitdown/app.py +63 -0
  147. universal_mcp/applications/miro/README.md +151 -0
  148. universal_mcp/applications/miro/__init__.py +1 -0
  149. universal_mcp/applications/miro/app.py +5429 -0
  150. universal_mcp/applications/ms-teams/README.md +42 -0
  151. universal_mcp/applications/ms-teams/__init__.py +1 -0
  152. universal_mcp/applications/ms-teams/app.py +1823 -0
  153. universal_mcp/applications/neon/README.md +74 -0
  154. universal_mcp/applications/neon/__init__.py +1 -0
  155. universal_mcp/applications/neon/app.py +2018 -0
  156. universal_mcp/applications/notion/README.md +30 -0
  157. universal_mcp/applications/notion/__init__.py +1 -0
  158. universal_mcp/applications/notion/app.py +527 -0
  159. universal_mcp/applications/openai/README.md +22 -0
  160. universal_mcp/applications/openai/__init__.py +1 -0
  161. universal_mcp/applications/openai/app.py +759 -0
  162. universal_mcp/applications/outlook/README.md +20 -0
  163. universal_mcp/applications/outlook/__init__.py +1 -0
  164. universal_mcp/applications/outlook/app.py +444 -0
  165. universal_mcp/applications/perplexity/README.md +12 -0
  166. universal_mcp/applications/perplexity/__init__.py +1 -0
  167. universal_mcp/applications/perplexity/app.py +65 -0
  168. universal_mcp/applications/pipedrive/README.md +284 -0
  169. universal_mcp/applications/pipedrive/__init__.py +1 -0
  170. universal_mcp/applications/pipedrive/app.py +12924 -0
  171. universal_mcp/applications/posthog/README.md +132 -0
  172. universal_mcp/applications/posthog/__init__.py +1 -0
  173. universal_mcp/applications/posthog/app.py +7125 -0
  174. universal_mcp/applications/reddit/README.md +135 -0
  175. universal_mcp/applications/reddit/__init__.py +1 -0
  176. universal_mcp/applications/reddit/app.py +4652 -0
  177. universal_mcp/applications/replicate/README.md +18 -0
  178. universal_mcp/applications/replicate/__init__.py +1 -0
  179. universal_mcp/applications/replicate/app.py +495 -0
  180. universal_mcp/applications/resend/README.md +40 -0
  181. universal_mcp/applications/resend/__init__.py +1 -0
  182. universal_mcp/applications/resend/app.py +881 -0
  183. universal_mcp/applications/retell/README.md +21 -0
  184. universal_mcp/applications/retell/__init__.py +1 -0
  185. universal_mcp/applications/retell/app.py +333 -0
  186. universal_mcp/applications/rocketlane/README.md +70 -0
  187. universal_mcp/applications/rocketlane/__init__.py +1 -0
  188. universal_mcp/applications/rocketlane/app.py +4346 -0
  189. universal_mcp/applications/semanticscholar/README.md +25 -0
  190. universal_mcp/applications/semanticscholar/__init__.py +1 -0
  191. universal_mcp/applications/semanticscholar/app.py +482 -0
  192. universal_mcp/applications/semrush/README.md +44 -0
  193. universal_mcp/applications/semrush/__init__.py +1 -0
  194. universal_mcp/applications/semrush/app.py +2081 -0
  195. universal_mcp/applications/sendgrid/README.md +362 -0
  196. universal_mcp/applications/sendgrid/__init__.py +1 -0
  197. universal_mcp/applications/sendgrid/app.py +9752 -0
  198. universal_mcp/applications/sentry/README.md +186 -0
  199. universal_mcp/applications/sentry/__init__.py +1 -0
  200. universal_mcp/applications/sentry/app.py +7471 -0
  201. universal_mcp/applications/serpapi/README.md +14 -0
  202. universal_mcp/applications/serpapi/__init__.py +1 -0
  203. universal_mcp/applications/serpapi/app.py +293 -0
  204. universal_mcp/applications/sharepoint/README.md +0 -0
  205. universal_mcp/applications/sharepoint/__init__.py +1 -0
  206. universal_mcp/applications/sharepoint/app.py +215 -0
  207. universal_mcp/applications/shopify/README.md +321 -0
  208. universal_mcp/applications/shopify/__init__.py +1 -0
  209. universal_mcp/applications/shopify/app.py +15392 -0
  210. universal_mcp/applications/shortcut/README.md +128 -0
  211. universal_mcp/applications/shortcut/__init__.py +1 -0
  212. universal_mcp/applications/shortcut/app.py +4478 -0
  213. universal_mcp/applications/slack/README.md +0 -0
  214. universal_mcp/applications/slack/__init__.py +1 -0
  215. universal_mcp/applications/slack/app.py +570 -0
  216. universal_mcp/applications/spotify/README.md +91 -0
  217. universal_mcp/applications/spotify/__init__.py +1 -0
  218. universal_mcp/applications/spotify/app.py +2526 -0
  219. universal_mcp/applications/supabase/README.md +87 -0
  220. universal_mcp/applications/supabase/__init__.py +1 -0
  221. universal_mcp/applications/supabase/app.py +2970 -0
  222. universal_mcp/applications/tavily/README.md +12 -0
  223. universal_mcp/applications/tavily/__init__.py +1 -0
  224. universal_mcp/applications/tavily/app.py +51 -0
  225. universal_mcp/applications/trello/README.md +266 -0
  226. universal_mcp/applications/trello/__init__.py +1 -0
  227. universal_mcp/applications/trello/app.py +10875 -0
  228. universal_mcp/applications/twillo/README.md +0 -0
  229. universal_mcp/applications/twillo/__init__.py +1 -0
  230. universal_mcp/applications/twillo/app.py +269 -0
  231. universal_mcp/applications/twitter/README.md +100 -0
  232. universal_mcp/applications/twitter/__init__.py +1 -0
  233. universal_mcp/applications/twitter/api_segments/__init__.py +0 -0
  234. universal_mcp/applications/twitter/api_segments/api_segment_base.py +51 -0
  235. universal_mcp/applications/twitter/api_segments/compliance_api.py +122 -0
  236. universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +255 -0
  237. universal_mcp/applications/twitter/api_segments/dm_events_api.py +140 -0
  238. universal_mcp/applications/twitter/api_segments/likes_api.py +159 -0
  239. universal_mcp/applications/twitter/api_segments/lists_api.py +395 -0
  240. universal_mcp/applications/twitter/api_segments/openapi_json_api.py +34 -0
  241. universal_mcp/applications/twitter/api_segments/spaces_api.py +309 -0
  242. universal_mcp/applications/twitter/api_segments/trends_api.py +40 -0
  243. universal_mcp/applications/twitter/api_segments/tweets_api.py +1403 -0
  244. universal_mcp/applications/twitter/api_segments/usage_api.py +40 -0
  245. universal_mcp/applications/twitter/api_segments/users_api.py +1498 -0
  246. universal_mcp/applications/twitter/app.py +46 -0
  247. universal_mcp/applications/unipile/README.md +28 -0
  248. universal_mcp/applications/unipile/__init__.py +1 -0
  249. universal_mcp/applications/unipile/app.py +829 -0
  250. universal_mcp/applications/whatsapp/README.md +23 -0
  251. universal_mcp/applications/whatsapp/__init__.py +1 -0
  252. universal_mcp/applications/whatsapp/app.py +595 -0
  253. universal_mcp/applications/whatsapp-business/README.md +34 -0
  254. universal_mcp/applications/whatsapp-business/__init__.py +1 -0
  255. universal_mcp/applications/whatsapp-business/app.py +1065 -0
  256. universal_mcp/applications/wrike/README.md +46 -0
  257. universal_mcp/applications/wrike/__init__.py +1 -0
  258. universal_mcp/applications/wrike/app.py +1583 -0
  259. universal_mcp/applications/youtube/README.md +57 -0
  260. universal_mcp/applications/youtube/__init__.py +1 -0
  261. universal_mcp/applications/youtube/app.py +1696 -0
  262. universal_mcp/applications/zenquotes/README.md +12 -0
  263. universal_mcp/applications/zenquotes/__init__.py +1 -0
  264. universal_mcp/applications/zenquotes/app.py +31 -0
  265. universal_mcp_applications-0.1.1.dist-info/METADATA +172 -0
  266. universal_mcp_applications-0.1.1.dist-info/RECORD +268 -0
  267. universal_mcp_applications-0.1.1.dist-info/WHEEL +4 -0
  268. universal_mcp_applications-0.1.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1696 @@
1
+ from typing import Any
2
+
3
+ from universal_mcp.applications.application import APIApplication
4
+ from universal_mcp.integrations import Integration
5
+ from youtube_transcript_api import YouTubeTranscriptApi
6
+
7
+
8
+ class YoutubeApp(APIApplication):
9
+ def __init__(self, integration: Integration = None, **kwargs) -> None:
10
+ """
11
+ Initializes an instance of a YouTube application integration.
12
+
13
+ Args:
14
+ integration: An optional Integration object to be used with the YouTube application integration.
15
+ kwargs: Additional keyword arguments to be passed to the parent class initializer.
16
+
17
+ Returns:
18
+ None
19
+ """
20
+ super().__init__(name="youtube", integration=integration, **kwargs)
21
+ self.base_url = "https://www.googleapis.com/youtube/v3"
22
+
23
+ def get_jobs_job_reports(
24
+ self,
25
+ jobId,
26
+ createdAfter=None,
27
+ onBehalfOfContentOwner=None,
28
+ pageSize=None,
29
+ pageToken=None,
30
+ startTimeAtOrAfter=None,
31
+ startTimeBefore=None,
32
+ ) -> Any:
33
+ """
34
+ Retrieves job reports for a specified job based on provided filters and parameters.
35
+
36
+ Args:
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
+ Raises:
49
+ ValueError: Raised if the required 'jobId' parameter is missing.
50
+
51
+ Tags:
52
+ retrieve, report, job-management, batch
53
+ """
54
+ if jobId is None:
55
+ raise ValueError("Missing required parameter 'jobId'")
56
+ url = f"{self.base_url}/v1/jobs/{jobId}/reports"
57
+ query_params = {
58
+ k: v
59
+ for k, v in [
60
+ ("createdAfter", createdAfter),
61
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
62
+ ("pageSize", pageSize),
63
+ ("pageToken", pageToken),
64
+ ("startTimeAtOrAfter", startTimeAtOrAfter),
65
+ ("startTimeBefore", startTimeBefore),
66
+ ]
67
+ if v is not None
68
+ }
69
+ response = self._get(url, params=query_params)
70
+ response.raise_for_status()
71
+ return response.json()
72
+
73
+ def get_jobs_job_reports_report(
74
+ self, jobId, reportId, onBehalfOfContentOwner=None
75
+ ) -> Any:
76
+ """
77
+ Retrieves a specific report associated with a job using the provided job and report identifiers.
78
+
79
+ Args:
80
+ jobId: The unique identifier for the job containing the report (required).
81
+ reportId: The unique identifier for the report to fetch (required).
82
+ onBehalfOfContentOwner: Optional; specifies the content owner for whom the request is made.
83
+
84
+ Returns:
85
+ A JSON object containing the fetched report details.
86
+
87
+ Raises:
88
+ ValueError: Raised if 'jobId' or 'reportId' is not provided.
89
+ requests.HTTPError: Raised if the API request fails (e.g., invalid permissions or resource not found).
90
+
91
+ Tags:
92
+ retrieve, report, job, api, json
93
+ """
94
+ if jobId is None:
95
+ raise ValueError("Missing required parameter 'jobId'")
96
+ if reportId is None:
97
+ raise ValueError("Missing required parameter 'reportId'")
98
+ url = f"{self.base_url}/v1/jobs/{jobId}/reports/{reportId}"
99
+ query_params = {
100
+ k: v
101
+ for k, v in [("onBehalfOfContentOwner", onBehalfOfContentOwner)]
102
+ if v is not None
103
+ }
104
+ response = self._get(url, params=query_params)
105
+ response.raise_for_status()
106
+ return response.json()
107
+
108
+ def delete_jobs_job(self, jobId, onBehalfOfContentOwner=None) -> Any:
109
+ """
110
+ Deletes a job with the specified ID, optionally acting on behalf of a content owner.
111
+
112
+ Args:
113
+ jobId: The unique identifier of the job to delete. Required.
114
+ onBehalfOfContentOwner: Optional. Content owner ID for delegated authorization.
115
+
116
+ Returns:
117
+ JSON response from the API as a Python dictionary.
118
+
119
+ Raises:
120
+ ValueError: Raised when jobId is None.
121
+ requests.exceptions.HTTPError: Raised for failed HTTP requests (e.g., invalid job ID, permission errors).
122
+
123
+ Tags:
124
+ delete, jobs, async_job, management
125
+ """
126
+ if jobId is None:
127
+ raise ValueError("Missing required parameter 'jobId'")
128
+ url = f"{self.base_url}/v1/jobs/{jobId}"
129
+ query_params = {
130
+ k: v
131
+ for k, v in [("onBehalfOfContentOwner", onBehalfOfContentOwner)]
132
+ if v is not None
133
+ }
134
+ response = self._delete(url, params=query_params)
135
+ response.raise_for_status()
136
+ return response.json()
137
+
138
+ def get_jobs(
139
+ self,
140
+ includeSystemManaged=None,
141
+ onBehalfOfContentOwner=None,
142
+ pageSize=None,
143
+ pageToken=None,
144
+ ) -> Any:
145
+ """
146
+ Retrieves a list of jobs from the server with optional filtering by query parameters.
147
+
148
+ Args:
149
+ includeSystemManaged: Optional boolean indicating whether to include system-managed jobs.
150
+ onBehalfOfContentOwner: Optional string representing the content owner on behalf of which the request is made.
151
+ pageSize: Optional integer specifying the number of jobs per page.
152
+ pageToken: Optional string for paginated results page token.
153
+
154
+ Returns:
155
+ JSON-decoded response containing the list of jobs and related metadata.
156
+
157
+ Raises:
158
+ HTTPError: Raised if the server returns an unsuccessful status code.
159
+
160
+ Tags:
161
+ list, scrape, management
162
+ """
163
+ url = f"{self.base_url}/v1/jobs"
164
+ query_params = {
165
+ k: v
166
+ for k, v in [
167
+ ("includeSystemManaged", includeSystemManaged),
168
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
169
+ ("pageSize", pageSize),
170
+ ("pageToken", pageToken),
171
+ ]
172
+ if v is not None
173
+ }
174
+ response = self._get(url, params=query_params)
175
+ response.raise_for_status()
176
+ return response.json()
177
+
178
+ def get_media_resource_name(self, resourceName) -> Any:
179
+ """
180
+ Retrieves a media resource by name and returns its JSON representation.
181
+
182
+ Args:
183
+ resourceName: The name of the media resource to retrieve. Required and cannot be None.
184
+
185
+ Returns:
186
+ JSON-formatted data representing the media resource.
187
+
188
+ Raises:
189
+ ValueError: If 'resourceName' is None.
190
+ requests.exceptions.HTTPError: If the HTTP request fails, such as a 404 for a non-existent resource.
191
+
192
+ Tags:
193
+ retrieve, media, json, http, get
194
+ """
195
+ if resourceName is None:
196
+ raise ValueError("Missing required parameter 'resourceName'")
197
+ url = f"{self.base_url}/v1/media/{resourceName}"
198
+ query_params = {}
199
+ response = self._get(url, params=query_params)
200
+ response.raise_for_status()
201
+ return response.json()
202
+
203
+ def get_reporttypes(
204
+ self,
205
+ includeSystemManaged=None,
206
+ onBehalfOfContentOwner=None,
207
+ pageSize=None,
208
+ pageToken=None,
209
+ ) -> Any:
210
+ """
211
+ Retrieves a paginated list of report types from the API with optional filtering.
212
+
213
+ Args:
214
+ includeSystemManaged: Boolean indicating whether to include system-managed report types in results.
215
+ onBehalfOfContentOwner: Content owner ID for delegated authority requests.
216
+ pageSize: Maximum number of items to return per response page.
217
+ pageToken: Token identifying a specific results page for pagination.
218
+
219
+ Returns:
220
+ Dictionary containing report type entries and pagination details, typically including 'items' list and 'nextPageToken' if applicable.
221
+
222
+ Raises:
223
+ HTTPError: If the API request fails due to network issues, authentication problems, or invalid parameters.
224
+
225
+ Tags:
226
+ retrieve, list, api-resource, filtering, pagination, report-management
227
+ """
228
+ url = f"{self.base_url}/v1/reportTypes"
229
+ query_params = {
230
+ k: v
231
+ for k, v in [
232
+ ("includeSystemManaged", includeSystemManaged),
233
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
234
+ ("pageSize", pageSize),
235
+ ("pageToken", pageToken),
236
+ ]
237
+ if v is not None
238
+ }
239
+ response = self._get(url, params=query_params)
240
+ response.raise_for_status()
241
+ return response.json()
242
+
243
+ def delete_captions(
244
+ self, id=None, onBehalfOf=None, onBehalfOfContentOwner=None
245
+ ) -> Any:
246
+ """
247
+ Deletes specified captions from a YouTube resource and returns the API response.
248
+
249
+ Args:
250
+ id: Optional unique identifier for the caption resource to delete.
251
+ onBehalfOf: Optional parameter identifying the user on whose behalf the request is made.
252
+ onBehalfOfContentOwner: Optional parameter specifying the content owner authorizing the request.
253
+
254
+ Returns:
255
+ JSON response containing the result of the DELETE operation from the YouTube API.
256
+
257
+ Raises:
258
+ HTTPError: Raised when the HTTP request fails, such as invalid ID, authentication failures, or API limitations exceeded.
259
+
260
+ Tags:
261
+ delete, captions, api, management
262
+ """
263
+ url = f"{self.base_url}/captions"
264
+ query_params = {
265
+ k: v
266
+ for k, v in [
267
+ ("id", id),
268
+ ("onBehalfOf", onBehalfOf),
269
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
270
+ ]
271
+ if v is not None
272
+ }
273
+ response = self._delete(url, params=query_params)
274
+ response.raise_for_status()
275
+ return response.json()
276
+
277
+
278
+ def get_captions(self, video_id: str) -> str:
279
+ """
280
+ Retrieves the captions text for a specified video ID on youtube
281
+
282
+ Args:
283
+ video_id: The unique identifier for the target video (required)
284
+
285
+ Returns:
286
+ String containing the complete transcript text without timestamps
287
+
288
+ Raises:
289
+ ValueError: Raised when required 'video_id' parameter is missing
290
+ Exception: Raised when transcript cannot be retrieved (e.g., no captions available)
291
+
292
+ Tags:
293
+ retrieve, transcript, text, captions
294
+ """
295
+ if video_id is None:
296
+ raise ValueError("Missing required parameter 'video_id'")
297
+
298
+ try:
299
+ api = YouTubeTranscriptApi()
300
+ transcript = api.fetch(video_id)
301
+
302
+ transcript_text = ' '.join([snippet.text for snippet in transcript.snippets])
303
+
304
+ return transcript_text
305
+ except Exception as e:
306
+ raise Exception(f"Failed to retrieve transcript for video {video_id}: {str(e)}")
307
+
308
+ def delete_comments(self, id=None) -> Any:
309
+ """
310
+ Deletes a comment or comments from the server based on the specified ID.
311
+
312
+ Args:
313
+ id: Optional ID of the comment to be deleted. If not provided, and based on implementation, all comments may be deleted.
314
+
315
+ Returns:
316
+ The JSON response from the server after attempting to delete the comment(s).
317
+
318
+ Raises:
319
+ requests.RequestException: Raised if there is a network error or an invalid response from the server.
320
+
321
+ Tags:
322
+ delete, comments, management
323
+ """
324
+ url = f"{self.base_url}/comments"
325
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
326
+ response = self._delete(url, params=query_params)
327
+ return self._handle_response(response)
328
+
329
+ def add_comments_mark_as_spam(self, id=None) -> Any:
330
+ """
331
+ Marks a comment as spam by sending a POST request to the API endpoint.
332
+
333
+ Args:
334
+ id: Optional unique identifier of the comment to mark as spam (included in request parameters when provided).
335
+
336
+ Returns:
337
+ JSON response from the API containing the operation result.
338
+
339
+ Raises:
340
+ HTTPError: If the POST request fails or returns a non-200 status code.
341
+
342
+ Tags:
343
+ comments, spam, post-request, api, moderation
344
+ """
345
+ url = f"{self.base_url}/comments/markAsSpam"
346
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
347
+ response = self._post(url, data={}, params=query_params)
348
+ response.raise_for_status()
349
+ return response.json()
350
+
351
+ def add_comments_set_moderation_status(
352
+ self, banAuthor=None, id=None, moderationStatus=None
353
+ ) -> Any:
354
+ """
355
+ Sets the moderation status for a comment and optionally bans the author through a POST request to a defined endpoint.
356
+
357
+ Args:
358
+ banAuthor: Optional boolean indicating whether to ban the comment's author
359
+ id: Optional string representing the unique identifier of the comment to moderate
360
+ moderationStatus: Optional string specifying the new moderation status (e.g., 'approved', 'rejected')
361
+
362
+ Returns:
363
+ JSON response from the server containing the result of the moderation operation
364
+
365
+ Raises:
366
+ requests.HTTPError: Raised when the HTTP request fails (e.g., invalid parameters or server errors)
367
+
368
+ Tags:
369
+ moderation, comments, management, api-client, status-update, ban-author
370
+ """
371
+ url = f"{self.base_url}/comments/setModerationStatus"
372
+ query_params = {
373
+ k: v
374
+ for k, v in [
375
+ ("banAuthor", banAuthor),
376
+ ("id", id),
377
+ ("moderationStatus", moderationStatus),
378
+ ]
379
+ if v is not None
380
+ }
381
+ response = self._post(url, data={}, params=query_params)
382
+ response.raise_for_status()
383
+ return response.json()
384
+
385
+ def delete_live_broadcasts(
386
+ self, id=None, onBehalfOfContentOwner=None, onBehalfOfContentOwnerChannel=None
387
+ ) -> Any:
388
+ """
389
+ Deletes specified live broadcasts using query parameters to filter requests.
390
+
391
+ Args:
392
+ id: Optional; Unique identifier of the live broadcast to delete (str).
393
+ onBehalfOfContentOwner: Optional; Content owner acting on behalf of (str).
394
+ onBehalfOfContentOwnerChannel: Optional; Channel ID linked to content owner (str).
395
+
396
+ Returns:
397
+ Dict[str, Any] containing the JSON-parsed response from the API request.
398
+
399
+ Raises:
400
+ requests.HTTPError: Raised for any HTTP request failures or invalid status codes (4XX/5XX).
401
+
402
+ Tags:
403
+ delete, live-broadcast, management, api
404
+ """
405
+ url = f"{self.base_url}/liveBroadcasts"
406
+ query_params = {
407
+ k: v
408
+ for k, v in [
409
+ ("id", id),
410
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
411
+ ("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
412
+ ]
413
+ if v is not None
414
+ }
415
+ response = self._delete(url, params=query_params)
416
+ response.raise_for_status()
417
+ return response.json()
418
+
419
+ def add_live_broadcasts_bind(
420
+ self,
421
+ id=None,
422
+ onBehalfOfContentOwner=None,
423
+ onBehalfOfContentOwnerChannel=None,
424
+ part=None,
425
+ streamId=None,
426
+ ) -> Any:
427
+ """
428
+ Binds a live broadcast to a stream on YouTube, using specified parameters for authentication and identification.
429
+
430
+ Args:
431
+ id: The id of the live broadcast to bind.
432
+ onBehalfOfContentOwner: The YouTube CMS content owner on behalf of whom the operation is performed.
433
+ onBehalfOfContentOwnerChannel: The YouTube channel ID for which the live broadcast is operated.
434
+ part: A comma-separated list of liveBroadcast resource properties to include in the API response.
435
+ streamId: The id of the stream to which the live broadcast is to be bound.
436
+
437
+ Returns:
438
+ The JSON response object from the YouTube API after attempting to bind the live broadcast to the stream.
439
+
440
+ Raises:
441
+ HTTPError: Raised if the request to the YouTube API fails, typically due to server errors or invalid responses.
442
+
443
+ Tags:
444
+ bind, youtube-api, live-broadcast, stream
445
+ """
446
+ url = f"{self.base_url}/liveBroadcasts/bind"
447
+ query_params = {
448
+ k: v
449
+ for k, v in [
450
+ ("id", id),
451
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
452
+ ("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
453
+ ("part", part),
454
+ ("streamId", streamId),
455
+ ]
456
+ if v is not None
457
+ }
458
+ response = self._post(url, data={}, params=query_params)
459
+ response.raise_for_status()
460
+ return response.json()
461
+
462
+ def add_live_broadcasts_control(
463
+ self,
464
+ displaySlate=None,
465
+ id=None,
466
+ offsetTimeMs=None,
467
+ onBehalfOfContentOwner=None,
468
+ onBehalfOfContentOwnerChannel=None,
469
+ part=None,
470
+ walltime=None,
471
+ ) -> Any:
472
+ """
473
+ Controls a live broadcast by sending a POST request with specified parameters.
474
+
475
+ Args:
476
+ displaySlate: Optional; Specifies whether or not to show a slate during the broadcast.
477
+ id: Optional; The ID of the live broadcast to control.
478
+ offsetTimeMs: Optional; The offset time in milliseconds for the broadcast control action.
479
+ onBehalfOfContentOwner: Optional; Indicates that the request is made on behalf of a content owner.
480
+ onBehalfOfContentOwnerChannel: Optional; The channel owned by the content owner.
481
+ part: Optional; Specifies a comma-separated list of one or more broadcasts resource properties.
482
+ walltime: Optional; An RFC 3339 timestamp that represents the time at which the action takes place.
483
+
484
+ Returns:
485
+ The JSON response from the server after controlling the live broadcast.
486
+
487
+ Raises:
488
+ requests.HTTPError: Raised if the HTTP request returns an unsuccessful status code.
489
+
490
+ Tags:
491
+ control, live-broadcast, async_job, management
492
+ """
493
+ url = f"{self.base_url}/liveBroadcasts/control"
494
+ query_params = {
495
+ k: v
496
+ for k, v in [
497
+ ("displaySlate", displaySlate),
498
+ ("id", id),
499
+ ("offsetTimeMs", offsetTimeMs),
500
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
501
+ ("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
502
+ ("part", part),
503
+ ("walltime", walltime),
504
+ ]
505
+ if v is not None
506
+ }
507
+ response = self._post(url, data={}, params=query_params)
508
+ response.raise_for_status()
509
+ return response.json()
510
+
511
+ def add_live_broadcasts_transition(
512
+ self,
513
+ broadcastStatus=None,
514
+ id=None,
515
+ onBehalfOfContentOwner=None,
516
+ onBehalfOfContentOwnerChannel=None,
517
+ part=None,
518
+ ) -> Any:
519
+ """
520
+ Transitions a live broadcast to a specified status for a given broadcast ID via API.
521
+
522
+ Args:
523
+ broadcastStatus: Optional; The status to which the live broadcast should be transitioned.
524
+ id: Optional; The unique identifier of the broadcast that needs to be transitioned.
525
+ onBehalfOfContentOwner: Optional; The YouTube content owner on whose behalf the API request is being made.
526
+ onBehalfOfContentOwnerChannel: Optional; The YouTube channel ID of the channel associated with the specified content owner.
527
+ part: Optional; A comma-separated list of one or more liveBroadcast resource properties that the API response will include.
528
+
529
+ Returns:
530
+ The JSON response from the API containing the details of the transitioned live broadcast.
531
+
532
+ Raises:
533
+ requests.HTTPError: Raised when the HTTP request to the API fails due to a server error or invalid request.
534
+
535
+ Tags:
536
+ transition, live-broadcast, youtube-api, video-management
537
+ """
538
+ url = f"{self.base_url}/liveBroadcasts/transition"
539
+ query_params = {
540
+ k: v
541
+ for k, v in [
542
+ ("broadcastStatus", broadcastStatus),
543
+ ("id", id),
544
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
545
+ ("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
546
+ ("part", part),
547
+ ]
548
+ if v is not None
549
+ }
550
+ response = self._post(url, data={}, params=query_params)
551
+ response.raise_for_status()
552
+ return response.json()
553
+
554
+ def delete_live_chat_bans(self, id=None) -> Any:
555
+ """
556
+ Deletes a live chat ban identified by the specified ID from the server.
557
+
558
+ Args:
559
+ id: Optional; The unique identifier of the live chat ban to delete. If None, no specific ban is targeted.
560
+
561
+ Returns:
562
+ The JSON response from the server after deletion, typically containing operation details.
563
+
564
+ Raises:
565
+ requests.HTTPError: Raised if the HTTP request fails, indicating server-side issues or invalid parameters.
566
+
567
+ Tags:
568
+ delete, management, live-chat, async-job
569
+ """
570
+ url = f"{self.base_url}/liveChat/bans"
571
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
572
+ response = self._delete(url, params=query_params)
573
+ response.raise_for_status()
574
+ return response.json()
575
+
576
+ def delete_live_chat_messages(self, id=None) -> Any:
577
+ """
578
+ Deletes live chat messages based on the specified message ID.
579
+
580
+ Args:
581
+ id: Optional; The identifier of the specific live chat message to be deleted. If not provided, it defaults to None.
582
+
583
+ Returns:
584
+ A JSON object containing the server's response to the deletion request. It includes details about the operation's success or failure.
585
+
586
+ Raises:
587
+ HTTPError: Raised if the HTTP request to delete the message fails.
588
+
589
+ Tags:
590
+ delete, live-chat, message-management
591
+ """
592
+ url = f"{self.base_url}/liveChat/messages"
593
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
594
+ response = self._delete(url, params=query_params)
595
+ response.raise_for_status()
596
+ return response.json()
597
+
598
+ def delete_live_chat_moderators(self, id=None) -> Any:
599
+ """
600
+ Deletes a live chat moderator by ID using the specified endpoint.
601
+
602
+ Args:
603
+ id: The ID of the live chat moderator to delete. When None, no deletion occurs (moderator IDs must be explicitly specified).
604
+
605
+ Returns:
606
+ Parsed JSON response from the server containing deletion confirmation or error details.
607
+
608
+ Raises:
609
+ requests.HTTPError: Raised for unsuccessful HTTP responses (e.g., invalid ID, authorization failure, or server errors).
610
+
611
+ Tags:
612
+ delete, moderators, management, live-chat, async_job, ids
613
+ """
614
+ url = f"{self.base_url}/liveChat/moderators"
615
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
616
+ response = self._delete(url, params=query_params)
617
+ response.raise_for_status()
618
+ return response.json()
619
+
620
+ def delete_videos(self, id=None, onBehalfOfContentOwner=None) -> Any:
621
+ """
622
+ Deletes specified videos from a video platform using API endpoints.
623
+
624
+ Args:
625
+ id: (str, optional): Unique identifier of the video to delete. If omitted, no video ID is specified.
626
+ onBehalfOfContentOwner: (str, optional): Content owner on whose behalf the operation is performed. Defaults to authenticated user.
627
+
628
+ Returns:
629
+ (Any): Parsed JSON response from the API including deletion status/errors.
630
+
631
+ Raises:
632
+ requests.HTTPError: Raised when the API request fails (e.g., invalid video ID, insufficient permissions).
633
+
634
+ Tags:
635
+ delete, video-management, api, async_job
636
+ """
637
+ url = f"{self.base_url}/videos"
638
+ query_params = {
639
+ k: v
640
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
641
+ if v is not None
642
+ }
643
+ response = self._delete(url, params=query_params)
644
+ response.raise_for_status()
645
+ return response.json()
646
+
647
+ def get_videos_get_rating(self, id=None, onBehalfOfContentOwner=None) -> Any:
648
+ """
649
+ Retrieves the rating of a video using its ID and optional content owner specification.
650
+
651
+ Args:
652
+ 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.
653
+ onBehalfOfContentOwner: Optional; Identifies the content owner for whom the request is being made.
654
+
655
+ Returns:
656
+ A JSON object containing the video rating information returned by the API.
657
+
658
+ Raises:
659
+ HTTPError: Raised if the HTTP request returns an unsuccessful status code.
660
+
661
+ Tags:
662
+ check, video-management
663
+ """
664
+ url = f"{self.base_url}/videos/getRating"
665
+ query_params = {
666
+ k: v
667
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
668
+ if v is not None
669
+ }
670
+ response = self._get(url, params=query_params)
671
+ response.raise_for_status()
672
+ return response.json()
673
+
674
+ def add_videos_rate(self, id=None, rating=None) -> Any:
675
+ """
676
+ Submits a rating for a video on the server using the provided video ID and rating value.
677
+
678
+ Args:
679
+ id: Optional; The unique identifier of the video to rate. If None, the video ID is not included in the request.
680
+ rating: Optional; The rating value to assign to the video. If None, the rating is not included in the request.
681
+
682
+ Returns:
683
+ The JSON response from the server after submitting the rating.
684
+
685
+ Raises:
686
+ HTTPError: Raised when the server returns an HTTP error status.
687
+
688
+ Tags:
689
+ rate, video-management, importance
690
+ """
691
+ url = f"{self.base_url}/videos/rate"
692
+ query_params = {
693
+ k: v for k, v in [("id", id), ("rating", rating)] if v is not None
694
+ }
695
+ response = self._post(url, data={}, params=query_params)
696
+ response.raise_for_status()
697
+ return response.json()
698
+
699
+ def add_videos_report_abuse(self, onBehalfOfContentOwner=None) -> Any:
700
+ """
701
+ Sends an abuse report for videos via the YouTube API, typically used to flag inappropriate content.
702
+
703
+ Args:
704
+ onBehalfOfContentOwner: Optional; YouTube content owner ID acting as the reporting entity (for partner accounts).
705
+
706
+ Returns:
707
+ Dict containing the JSON response from the YouTube API after reporting abuse.
708
+
709
+ Raises:
710
+ HTTPError: Raised when the YouTube API request fails, typically due to authentication errors or invalid parameters.
711
+
712
+ Tags:
713
+ report, abuse, video, content, api
714
+ """
715
+ url = f"{self.base_url}/videos/reportAbuse"
716
+ query_params = {
717
+ k: v
718
+ for k, v in [("onBehalfOfContentOwner", onBehalfOfContentOwner)]
719
+ if v is not None
720
+ }
721
+ response = self._post(url, data={}, params=query_params)
722
+ response.raise_for_status()
723
+ return response.json()
724
+
725
+ def add_watermarks_set(self, channelId=None, onBehalfOfContentOwner=None) -> Any:
726
+ """
727
+ Sets watermarks on a specified YouTube channel using optional content owner credentials.
728
+
729
+ Args:
730
+ channelId: Optional; The ID of the YouTube channel on which to set the watermark.
731
+ onBehalfOfContentOwner: Optional; The content owner's ID that the request is made on behalf of.
732
+
733
+ Returns:
734
+ The JSON response from the API call, which includes details about the watermark setting operation.
735
+
736
+ Raises:
737
+ requests.RequestException: Raised if there is an error with the API request, such as connection issues or invalid response status.
738
+
739
+ Tags:
740
+ watermark, youtube, management, channel-config
741
+ """
742
+ url = f"{self.base_url}/watermarks/set"
743
+ query_params = {
744
+ k: v
745
+ for k, v in [
746
+ ("channelId", channelId),
747
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
748
+ ]
749
+ if v is not None
750
+ }
751
+ response = self._post(url, data={}, params=query_params)
752
+ response.raise_for_status()
753
+ return response.json()
754
+
755
+ def add_watermarks_unset(self, channelId=None, onBehalfOfContentOwner=None) -> Any:
756
+ """
757
+ Removes watermarks from a YouTube channel specified by channel ID.
758
+
759
+ Args:
760
+ channelId: Optional; The unique identifier of the YouTube channel from which to remove watermarks.
761
+ onBehalfOfContentOwner: Optional; The content owner that the request is on behalf of, used by YouTube content partners.
762
+
763
+ Returns:
764
+ The JSON response from the YouTube API after attempting to remove the watermarks.
765
+
766
+ Raises:
767
+ HTTPError: Raised when there is an error in the HTTP request or if the server returns a status code indicating a client or server error.
768
+
769
+ Tags:
770
+ remove, watermark, youtube
771
+ """
772
+ url = f"{self.base_url}/watermarks/unset"
773
+ query_params = {
774
+ k: v
775
+ for k, v in [
776
+ ("channelId", channelId),
777
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
778
+ ]
779
+ if v is not None
780
+ }
781
+ response = self._post(url, data={}, params=query_params)
782
+ response.raise_for_status()
783
+ return response.json()
784
+
785
+ def get_activities(
786
+ self,
787
+ channelId=None,
788
+ home=None,
789
+ maxResults=None,
790
+ mine=None,
791
+ pageToken=None,
792
+ part=None,
793
+ publishedAfter=None,
794
+ publishedBefore=None,
795
+ regionCode=None,
796
+ ) -> Any:
797
+ """
798
+ Retrieve YouTube channel activities based on specified filters and parameters.
799
+
800
+ Args:
801
+ channelId: The YouTube channel ID to fetch activities from. If None, fetches from multiple sources (depending on other parameters).
802
+ home: If True, retrieves activities from the user's personalized YouTube home feed. Requires authentication if mine is not specified.
803
+ maxResults: Maximum number of items to return in the response list (1-50, default server-side limit).
804
+ mine: If True, retrieves activities from the authenticated user's channel. Requires authentication.
805
+ pageToken: Token to fetch a specific page of results, used for pagination.
806
+ part: Comma-separated list of resource parts to include in the response (e.g., 'snippet,contentDetails').
807
+ publishedAfter: Filter activities published after this datetime (ISO 8601 format).
808
+ publishedBefore: Filter activities published before this datetime (ISO 8601 format).
809
+ regionCode: Return activities viewable in the specified two-letter ISO country code.
810
+
811
+ Returns:
812
+ Dictionary containing parsed JSON response with activity data.
813
+
814
+ Raises:
815
+ requests.HTTPError: Raised when the API request fails due to invalid parameters, authentication issues, or server errors.
816
+
817
+ Tags:
818
+ retrieve, activities, youtube, api-client, pagination, filter, async
819
+ """
820
+ url = f"{self.base_url}/activities"
821
+ query_params = {
822
+ k: v
823
+ for k, v in [
824
+ ("channelId", channelId),
825
+ ("home", home),
826
+ ("maxResults", maxResults),
827
+ ("mine", mine),
828
+ ("pageToken", pageToken),
829
+ ("part", part),
830
+ ("publishedAfter", publishedAfter),
831
+ ("publishedBefore", publishedBefore),
832
+ ("regionCode", regionCode),
833
+ ]
834
+ if v is not None
835
+ }
836
+ response = self._get(url, params=query_params)
837
+ response.raise_for_status()
838
+ return response.json()
839
+
840
+ def add_channel_banners_insert(
841
+ self, channelId=None, onBehalfOfContentOwner=None
842
+ ) -> Any:
843
+ """
844
+ Inserts a new channel banner for a YouTube channel using the YouTube Data API.
845
+
846
+ Args:
847
+ channelId: Optional string specifying the unique identifier of the YouTube channel for banner insertion
848
+ onBehalfOfContentOwner: Optional string indicating the content owner's external ID when acting on their behalf
849
+
850
+ Returns:
851
+ JSON object containing the API response with details of the newly inserted channel banner
852
+
853
+ Raises:
854
+ HTTPError: Raised when the YouTube Data API request fails (4XX or 5XX status code)
855
+
856
+ Tags:
857
+ insert, channel, banner, youtube-api, management, async_job
858
+ """
859
+ url = f"{self.base_url}/channelBanners/insert"
860
+ query_params = {
861
+ k: v
862
+ for k, v in [
863
+ ("channelId", channelId),
864
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
865
+ ]
866
+ if v is not None
867
+ }
868
+ response = self._post(url, data={}, params=query_params)
869
+ response.raise_for_status()
870
+ return response.json()
871
+
872
+ def delete_channel_sections(self, id=None, onBehalfOfContentOwner=None) -> Any:
873
+ """
874
+ Deletes one or more channel sections from the specified platform using the provided identifiers.
875
+
876
+ Args:
877
+ id: Optional string representing the unique identifier of the target channel section. If omitted, no specific deletion occurs (behavior depends on API implementation).
878
+ onBehalfOfContentOwner: Optional string indicating the content owner on whose behalf the request is made.
879
+
880
+ Returns:
881
+ JSON-decoded response payload from the API server after deletion attempt.
882
+
883
+ Raises:
884
+ requests.HTTPError: Raised for HTTP 4xx/5xx responses from the server during the deletion request.
885
+
886
+ Tags:
887
+ delete, channel-section, management
888
+ """
889
+ url = f"{self.base_url}/channelSections"
890
+ query_params = {
891
+ k: v
892
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
893
+ if v is not None
894
+ }
895
+ response = self._delete(url, params=query_params)
896
+ response.raise_for_status()
897
+ return response.json()
898
+
899
+ def get_channels(
900
+ self,
901
+ categoryId=None,
902
+ forUsername=None,
903
+ hl=None,
904
+ id=None,
905
+ managedByMe=None,
906
+ maxResults=None,
907
+ mine=None,
908
+ mySubscribers=None,
909
+ onBehalfOfContentOwner=None,
910
+ pageToken=None,
911
+ part=None,
912
+ ) -> Any:
913
+ """
914
+ Retrieves YouTube channels based on specified parameters.
915
+
916
+ Args:
917
+ categoryId: Category ID to filter channels.
918
+ forUsername: Username to retrieve channels for.
919
+ hl: Language code for localized output.
920
+ id: List of channel IDs to retrieve.
921
+ managedByMe: Flag to retrieve channels managed by the current user.
922
+ maxResults: Maximum number of results to return.
923
+ mine: Flag to retrieve channels owned by the current user.
924
+ mySubscribers: Flag to retrieve channels subscribed by the current user.
925
+ onBehalfOfContentOwner: Content owner ID to retrieve channels on behalf of.
926
+ pageToken: Token for pagination.
927
+ part: Specified parts of the channel resource to include in the response.
928
+
929
+ Returns:
930
+ JSON response containing the requested channels.
931
+
932
+ Raises:
933
+ ResponseError: Raised if there is an error in the HTTP response.
934
+
935
+ Tags:
936
+ search, youtube, channels, management, important
937
+ """
938
+ url = f"{self.base_url}/channels"
939
+ query_params = {
940
+ k: v
941
+ for k, v in [
942
+ ("categoryId", categoryId),
943
+ ("forUsername", forUsername),
944
+ ("hl", hl),
945
+ ("id", id),
946
+ ("managedByMe", managedByMe),
947
+ ("maxResults", maxResults),
948
+ ("mine", mine),
949
+ ("mySubscribers", mySubscribers),
950
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
951
+ ("pageToken", pageToken),
952
+ ("part", part),
953
+ ]
954
+ if v is not None
955
+ }
956
+ response = self._get(url, params=query_params)
957
+ response.raise_for_status()
958
+ return response.json()
959
+
960
+ def get_comment_threads(
961
+ self,
962
+ allThreadsRelatedToChannelId=None,
963
+ channelId=None,
964
+ id=None,
965
+ maxResults=None,
966
+ moderationStatus=None,
967
+ order=None,
968
+ pageToken=None,
969
+ part=None,
970
+ searchTerms=None,
971
+ textFormat=None,
972
+ videoId=None,
973
+ ) -> Any:
974
+ """
975
+ Retrieve YouTube comment threads based on specified filters and pagination parameters.
976
+
977
+ Args:
978
+ allThreadsRelatedToChannelId: Returns all threads associated with the specified channel, including replies
979
+ channelId: Channel ID to filter comment threads
980
+ id: Specific comment thread ID(s) to retrieve
981
+ maxResults: Maximum number of items to return (1-100)
982
+ moderationStatus: Filter by moderation status (e.g., 'heldForReview')
983
+ order: Sort order for results (e.g., 'time', 'relevance')
984
+ pageToken: Pagination token for retrieving specific result pages
985
+ part: Comma-separated list of resource properties to include
986
+ searchTerms: Text search query to filter comments
987
+ textFormat: Formatting for comment text (e.g., 'html', 'plainText')
988
+ videoId: Video ID to filter associated comment threads
989
+
990
+ Returns:
991
+ JSON response containing comment thread data and pagination information
992
+
993
+ Raises:
994
+ HTTPError: Raised for unsuccessful API requests (4xx/5xx status codes)
995
+
996
+ Tags:
997
+ retrieve, comments, pagination, youtube-api, rest, data-fetch
998
+ """
999
+ url = f"{self.base_url}/commentThreads"
1000
+ query_params = {
1001
+ k: v
1002
+ for k, v in [
1003
+ ("allThreadsRelatedToChannelId", allThreadsRelatedToChannelId),
1004
+ ("channelId", channelId),
1005
+ ("id", id),
1006
+ ("maxResults", maxResults),
1007
+ ("moderationStatus", moderationStatus),
1008
+ ("order", order),
1009
+ ("pageToken", pageToken),
1010
+ ("part", part),
1011
+ ("searchTerms", searchTerms),
1012
+ ("textFormat", textFormat),
1013
+ ("videoId", videoId),
1014
+ ]
1015
+ if v is not None
1016
+ }
1017
+ response = self._get(url, params=query_params)
1018
+ response.raise_for_status()
1019
+ return response.json()
1020
+
1021
+ def get_fanfundingevents(
1022
+ self, hl=None, maxResults=None, pageToken=None, part=None
1023
+ ) -> Any:
1024
+ """
1025
+ Retrieves fan funding events based on specified filter criteria.
1026
+
1027
+ Args:
1028
+ hl: Optional; a string representing the language for text values.
1029
+ maxResults: Optional; an integer specifying the maximum number of results to return.
1030
+ pageToken: Optional; a string token to retrieve a specific page in a paginated set of results.
1031
+ part: Optional; a comma-separated list of one or more 'fanFundingEvent' resource properties that the API response will include.
1032
+
1033
+ Returns:
1034
+ A JSON-decoded response of the fan funding events data retrieved from the API.
1035
+
1036
+ Raises:
1037
+ HTTPError: Raised if the API request returns a status code that indicates an error.
1038
+
1039
+ Tags:
1040
+ retrieve, events, fanfunding
1041
+ """
1042
+ url = f"{self.base_url}/fanFundingEvents"
1043
+ query_params = {
1044
+ k: v
1045
+ for k, v in [
1046
+ ("hl", hl),
1047
+ ("maxResults", maxResults),
1048
+ ("pageToken", pageToken),
1049
+ ("part", part),
1050
+ ]
1051
+ if v is not None
1052
+ }
1053
+ response = self._get(url, params=query_params)
1054
+ response.raise_for_status()
1055
+ return response.json()
1056
+
1057
+ def get_guecategories(self, hl=None, id=None, part=None, regionCode=None) -> Any:
1058
+ """
1059
+ Fetches guide categories from a remote service based on specified parameters.
1060
+
1061
+ Args:
1062
+ hl: Optional; a string that specifies the language localization.
1063
+ id: Optional; a string representing the ID of the guide category.
1064
+ part: Optional; a string indicating which parts of the guide category resource to return.
1065
+ regionCode: Optional; a string that denotes the region of interest.
1066
+
1067
+ Returns:
1068
+ A dictionary containing the JSON response representing guide categories from the service.
1069
+
1070
+ Raises:
1071
+ requests.exceptions.HTTPError: Raised if the HTTP request returns an unsuccessful status code.
1072
+
1073
+ Tags:
1074
+ get, fetch, guide-categories, api-call
1075
+ """
1076
+ url = f"{self.base_url}/guideCategories"
1077
+ query_params = {
1078
+ k: v
1079
+ for k, v in [
1080
+ ("hl", hl),
1081
+ ("id", id),
1082
+ ("part", part),
1083
+ ("regionCode", regionCode),
1084
+ ]
1085
+ if v is not None
1086
+ }
1087
+ response = self._get(url, params=query_params)
1088
+ response.raise_for_status()
1089
+ return response.json()
1090
+
1091
+ def get_languages(self, hl=None, part=None) -> Any:
1092
+ """
1093
+ Fetches a list of supported languages from the internationalization API, returning localized names when specified.
1094
+
1095
+ Args:
1096
+ hl: Optional language code to localize returned language names (e.g., 'en' for English).
1097
+ part: Optional comma-separated list of i18nLanguage resource properties to include in response.
1098
+
1099
+ Returns:
1100
+ JSON object containing API response with supported languages data.
1101
+
1102
+ Raises:
1103
+ HTTPError: Raised for unsuccessful API requests (4XX/5XX status codes).
1104
+
1105
+ Tags:
1106
+ fetch, i18n, languages, api-client
1107
+ """
1108
+ url = f"{self.base_url}/i18nLanguages"
1109
+ query_params = {k: v for k, v in [("hl", hl), ("part", part)] if v is not None}
1110
+ response = self._get(url, params=query_params)
1111
+ response.raise_for_status()
1112
+ return response.json()
1113
+
1114
+ def get_regions(self, hl=None, part=None) -> Any:
1115
+ """
1116
+ Retrieves a list of i18n regions from an API endpoint.
1117
+
1118
+ Args:
1119
+ hl: Optional string representing language code for regional localization.
1120
+ part: Optional comma-separated string specifying i18nRegion resource parts to include.
1121
+
1122
+ Returns:
1123
+ JSON response containing i18n regions data.
1124
+
1125
+ Raises:
1126
+ HTTPError: If the API request fails with a 4XX/5XX status code.
1127
+
1128
+ Tags:
1129
+ list, regions, i18n, api
1130
+ """
1131
+ url = f"{self.base_url}/i18nRegions"
1132
+ query_params = {k: v for k, v in [("hl", hl), ("part", part)] if v is not None}
1133
+ response = self._get(url, params=query_params)
1134
+ response.raise_for_status()
1135
+ return response.json()
1136
+
1137
+ def delete_livestreams(
1138
+ self, id=None, onBehalfOfContentOwner=None, onBehalfOfContentOwnerChannel=None
1139
+ ) -> Any:
1140
+ """
1141
+ Deletes a YouTube livestream resource using the YouTube Data API with optional filtering parameters.
1142
+
1143
+ Args:
1144
+ id: Optional; A comma-separated list of YouTube livestream IDs to be deleted.
1145
+ onBehalfOfContentOwner: Optional; The YouTube content owner who is the channel owner of the livestream and makes this API call.
1146
+ onBehalfOfContentOwnerChannel: Optional; The YouTube channel ID on behalf of which the API call is made.
1147
+
1148
+ Returns:
1149
+ A JSON object containing the API's response to the delete request.
1150
+
1151
+ Raises:
1152
+ requests.HTTPError: Raised when the HTTP request returns an unsuccessful status code.
1153
+
1154
+ Tags:
1155
+ delete, livestream, youtube, api
1156
+ """
1157
+ url = f"{self.base_url}/liveStreams"
1158
+ query_params = {
1159
+ k: v
1160
+ for k, v in [
1161
+ ("id", id),
1162
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
1163
+ ("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
1164
+ ]
1165
+ if v is not None
1166
+ }
1167
+ response = self._delete(url, params=query_params)
1168
+ response.raise_for_status()
1169
+ return response.json()
1170
+
1171
+ def delete_play_list_items(self, id=None, onBehalfOfContentOwner=None) -> Any:
1172
+ """
1173
+ Deletes playlist items identified by the given ID or on behalf of the specified content owner.
1174
+
1175
+ Args:
1176
+ id: Optional; The ID of the playlist item to be deleted.
1177
+ onBehalfOfContentOwner: Optional; The content owner on whose behalf the playlist item is being deleted.
1178
+
1179
+ Returns:
1180
+ JSON response from the server indicating the result of the deletion operation.
1181
+
1182
+ Raises:
1183
+ HTTPError: Raised if the API request fails due to invalid parameters, authorization issues, or server errors.
1184
+
1185
+ Tags:
1186
+ delete, playlist-items, management
1187
+ """
1188
+ url = f"{self.base_url}/playlistItems"
1189
+ query_params = {
1190
+ k: v
1191
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
1192
+ if v is not None
1193
+ }
1194
+ response = self._delete(url, params=query_params)
1195
+ response.raise_for_status()
1196
+ return response.json()
1197
+
1198
+ def delete_playlists(self, id=None, onBehalfOfContentOwner=None) -> Any:
1199
+ """
1200
+ Deletes playlists via the YouTube Data API based on specified criteria.
1201
+
1202
+ Args:
1203
+ id: Optional; A string representing the ID of the playlist to delete. If None, operation details depend on API implementation (not recommended without explicit identifier).
1204
+ onBehalfOfContentOwner: Optional; A string representing the content owner on whose behalf the operation is performed. Used for delegated access.
1205
+
1206
+ Returns:
1207
+ Dictionary containing the JSON response from the YouTube API after playlist deletion.
1208
+
1209
+ Raises:
1210
+ HTTPError: Raised when the API request fails, typically due to invalid permissions, non-existent playlist, or network issues.
1211
+
1212
+ Tags:
1213
+ delete, playlists, youtube-api, management
1214
+ """
1215
+ url = f"{self.base_url}/playlists"
1216
+ query_params = {
1217
+ k: v
1218
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
1219
+ if v is not None
1220
+ }
1221
+ response = self._delete(url, params=query_params)
1222
+ response.raise_for_status()
1223
+ return response.json()
1224
+
1225
+ def get_search(
1226
+ self,
1227
+ channelId=None,
1228
+ channelType=None,
1229
+ eventType=None,
1230
+ forContentOwner=None,
1231
+ forDeveloper=None,
1232
+ forMine=None,
1233
+ location=None,
1234
+ locationRadius=None,
1235
+ maxResults=None,
1236
+ onBehalfOfContentOwner=None,
1237
+ order=None,
1238
+ pageToken=None,
1239
+ part=None,
1240
+ publishedAfter=None,
1241
+ publishedBefore=None,
1242
+ q=None,
1243
+ regionCode=None,
1244
+ relatedToVideoId=None,
1245
+ relevanceLanguage=None,
1246
+ safeSearch=None,
1247
+ topicId=None,
1248
+ type=None,
1249
+ videoCaption=None,
1250
+ videoCategoryId=None,
1251
+ videoDefinition=None,
1252
+ videoDimension=None,
1253
+ videoDuration=None,
1254
+ videoEmbeddable=None,
1255
+ videoLicense=None,
1256
+ videoSyndicated=None,
1257
+ videoType=None,
1258
+ ) -> Any:
1259
+ """
1260
+ Submits a search query to the YouTube Data API with optional filters.
1261
+
1262
+ Args:
1263
+ channelId: Channel filter for the search.
1264
+ channelType: Type of channel to filter by.
1265
+ eventType: Type of event to filter by.
1266
+ forContentOwner: Whether to search for content owned by the specified content owner.
1267
+ forDeveloper: Whether to search for content owned by the developer.
1268
+ forMine: Whether to search for the user's videos.
1269
+ location: Geographic location to filter results by.
1270
+ locationRadius: Radius of the geographic location.
1271
+ maxResults: Maximum number of search results to return.
1272
+ onBehalfOfContentOwner: Owner ID when acting on behalf of a content owner.
1273
+ order: Order in which search results are returned.
1274
+ pageToken: Page token for pagination.
1275
+ part: Response parts to return.
1276
+ publishedAfter: After date to filter by.
1277
+ publishedBefore: Before date to filter by.
1278
+ q: Search query string.
1279
+ regionCode: Region code to filter by.
1280
+ relatedToVideoId: Search related videos to the specified ID.
1281
+ relevanceLanguage: Language used for relevance.
1282
+ safeSearch: Safe search settings.
1283
+ topicId: Topic filter.
1284
+ type: Type of resource to return.
1285
+ videoCaption: Caption filter for videos.
1286
+ videoCategoryId: Category of videos.
1287
+ videoDefinition: Video definition filter (e.g., 'hd').
1288
+ videoDimension: Dimension filter (e.g., '2d', '3d').
1289
+ videoDuration: Duration filter for videos.
1290
+ videoEmbeddable: Whether videos are embeddable.
1291
+ videoLicense: License filter for videos.
1292
+ videoSyndicated: Whether videos are syndicated.
1293
+ videoType: Type of video (e.g., 'movie', 'episode')
1294
+
1295
+ Returns:
1296
+ JSON response containing the search results.
1297
+
1298
+ Raises:
1299
+ HTTPError: If the request to the YouTube Data API fails.
1300
+
1301
+ Tags:
1302
+ search, youtube-api, video-search, web-api, important
1303
+ """
1304
+ url = f"{self.base_url}/search"
1305
+ query_params = {
1306
+ k: v
1307
+ for k, v in [
1308
+ ("channelId", channelId),
1309
+ ("channelType", channelType),
1310
+ ("eventType", eventType),
1311
+ ("forContentOwner", forContentOwner),
1312
+ ("forDeveloper", forDeveloper),
1313
+ ("forMine", forMine),
1314
+ ("location", location),
1315
+ ("locationRadius", locationRadius),
1316
+ ("maxResults", maxResults),
1317
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
1318
+ ("order", order),
1319
+ ("pageToken", pageToken),
1320
+ ("part", part),
1321
+ ("publishedAfter", publishedAfter),
1322
+ ("publishedBefore", publishedBefore),
1323
+ ("q", q),
1324
+ ("regionCode", regionCode),
1325
+ ("relatedToVideoId", relatedToVideoId),
1326
+ ("relevanceLanguage", relevanceLanguage),
1327
+ ("safeSearch", safeSearch),
1328
+ ("topicId", topicId),
1329
+ ("type", type),
1330
+ ("videoCaption", videoCaption),
1331
+ ("videoCategoryId", videoCategoryId),
1332
+ ("videoDefinition", videoDefinition),
1333
+ ("videoDimension", videoDimension),
1334
+ ("videoDuration", videoDuration),
1335
+ ("videoEmbeddable", videoEmbeddable),
1336
+ ("videoLicense", videoLicense),
1337
+ ("videoSyndicated", videoSyndicated),
1338
+ ("videoType", videoType),
1339
+ ]
1340
+ if v is not None
1341
+ }
1342
+ response = self._get(url, params=query_params)
1343
+ response.raise_for_status()
1344
+ return response.json()
1345
+
1346
+ def get_sponsors(
1347
+ self, filter=None, maxResults=None, pageToken=None, part=None
1348
+ ) -> Any:
1349
+ """
1350
+ Fetches a list of sponsors from a server with optional filtering and pagination.
1351
+
1352
+ Args:
1353
+ filter: Optional string containing filtering criteria for sponsors.
1354
+ maxResults: Optional integer limiting the number of returned sponsors.
1355
+ pageToken: Optional token string for paginating to a specific result page.
1356
+ part: Optional string specifying which sponsor detail parts to include.
1357
+
1358
+ Returns:
1359
+ JSON response containing the list of sponsors (filtered/paginated) as returned by the server.
1360
+
1361
+ Raises:
1362
+ requests.HTTPError: If the HTTP request fails or returns a non-200 status code.
1363
+
1364
+ Tags:
1365
+ fetch, list, pagination, filter, sponsors, api
1366
+ """
1367
+ url = f"{self.base_url}/sponsors"
1368
+ query_params = {
1369
+ k: v
1370
+ for k, v in [
1371
+ ("filter", filter),
1372
+ ("maxResults", maxResults),
1373
+ ("pageToken", pageToken),
1374
+ ("part", part),
1375
+ ]
1376
+ if v is not None
1377
+ }
1378
+ response = self._get(url, params=query_params)
1379
+ response.raise_for_status()
1380
+ return response.json()
1381
+
1382
+ def delete_subscriptions(self, id=None) -> Any:
1383
+ """
1384
+ Deletes one or all subscriptions by sending a DELETE request to the API endpoint.
1385
+
1386
+ Args:
1387
+ id: Optional identifier for a specific subscription to delete (str, int, or None). If None, deletes all subscriptions.
1388
+
1389
+ Returns:
1390
+ JSON-formatted response from the API containing deletion results.
1391
+
1392
+ Raises:
1393
+ HTTPError: Raised for HTTP request failures (4XX/5XX status codes) during the deletion attempt.
1394
+
1395
+ Tags:
1396
+ delete, subscriptions, async-job, management
1397
+ """
1398
+ url = f"{self.base_url}/subscriptions"
1399
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
1400
+ response = self._delete(url, params=query_params)
1401
+ response.raise_for_status()
1402
+ return response.json()
1403
+
1404
+ def get_superchatevents(
1405
+ self, hl=None, maxResults=None, pageToken=None, part=None
1406
+ ) -> Any:
1407
+ """
1408
+ Fetches a list of super chat events from the YouTube API with optional filtering parameters.
1409
+
1410
+ Args:
1411
+ hl: Optional; the language code to select localized resource information.
1412
+ maxResults: Optional; the maximum number of items that should be returned in the result set.
1413
+ pageToken: Optional; the token to identify a specific page in the result set.
1414
+ part: Optional; the parameter specifying which super chat event resource parts to include in the response.
1415
+
1416
+ Returns:
1417
+ A JSON object containing the super chat events data returned by the YouTube API.
1418
+
1419
+ Raises:
1420
+ RequestException: Raised if there is an issue with the HTTP request, such as network or server errors.
1421
+
1422
+ Tags:
1423
+ fetch, youtube-api, async-job
1424
+ """
1425
+ url = f"{self.base_url}/superChatEvents"
1426
+ query_params = {
1427
+ k: v
1428
+ for k, v in [
1429
+ ("hl", hl),
1430
+ ("maxResults", maxResults),
1431
+ ("pageToken", pageToken),
1432
+ ("part", part),
1433
+ ]
1434
+ if v is not None
1435
+ }
1436
+ response = self._get(url, params=query_params)
1437
+ response.raise_for_status()
1438
+ return response.json()
1439
+
1440
+ def add_thumbnails_set(self, onBehalfOfContentOwner=None, videoId=None) -> Any:
1441
+ """
1442
+ Sets a thumbnail for a specified video on behalf of a content owner using the YouTube API.
1443
+
1444
+ Args:
1445
+ onBehalfOfContentOwner: Optional; str. The YouTube content owner ID on whose behalf the request is being made.
1446
+ videoId: Optional; str. The ID of the video for which the thumbnails are being set.
1447
+
1448
+ Returns:
1449
+ dict. The response from the YouTube API as a JSON object, containing details of the updated video thumbnail.
1450
+
1451
+ Raises:
1452
+ HTTPError: Raised if the HTTP request returns an unsuccessful status code.
1453
+
1454
+ Tags:
1455
+ thumbnail, youtube-api, video-management, async-job
1456
+ """
1457
+ url = f"{self.base_url}/thumbnails/set"
1458
+ query_params = {
1459
+ k: v
1460
+ for k, v in [
1461
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
1462
+ ("videoId", videoId),
1463
+ ]
1464
+ if v is not None
1465
+ }
1466
+ response = self._post(url, data={}, params=query_params)
1467
+ response.raise_for_status()
1468
+ return response.json()
1469
+
1470
+ def get_video_abuse_report_reasons(self, hl=None, part=None) -> Any:
1471
+ """
1472
+ Fetches video abuse report reasons with optional localization and response filtering.
1473
+
1474
+ Args:
1475
+ hl: Optional BCP-47 language code for localizing the response (e.g., 'en' or 'fr').
1476
+ part: Optional parameter specifying which parts of the abuse report reasons to include in the response (e.g., 'id' or 'snippet').
1477
+
1478
+ Returns:
1479
+ A JSON object containing the list of video abuse report reasons, or filtered parts if specified.
1480
+
1481
+ Raises:
1482
+ requests.RequestException: Raised if there is a problem with the HTTP request (e.g., network issues or invalid response).
1483
+
1484
+ Tags:
1485
+ fetch, management, abuse-report, video-content
1486
+ """
1487
+ url = f"{self.base_url}/videoAbuseReportReasons"
1488
+ query_params = {k: v for k, v in [("hl", hl), ("part", part)] if v is not None}
1489
+ response = self._get(url, params=query_params)
1490
+ response.raise_for_status()
1491
+ return response.json()
1492
+
1493
+ def get_veocategories(self, hl=None, id=None, part=None, regionCode=None) -> Any:
1494
+ """
1495
+ Fetches video categories from an external API using specified query parameters and returns the parsed JSON response.
1496
+
1497
+ Args:
1498
+ hl: Optional; the language code (e.g., 'en') for localized video category names
1499
+ id: Optional; comma-separated list of video category IDs to filter results
1500
+ part: Optional; list of properties (e.g., 'snippet') to include in the response
1501
+ regionCode: Optional; ISO 3166-1 alpha-2 country code to filter region-specific categories
1502
+
1503
+ Returns:
1504
+ Dictionary containing parsed JSON response with video category details
1505
+
1506
+ Raises:
1507
+ requests.HTTPError: Raised when the API request fails with a non-success status code
1508
+
1509
+ Tags:
1510
+ fetch, video-categories, api-request, json-response
1511
+ """
1512
+ url = f"{self.base_url}/videoCategories"
1513
+ query_params = {
1514
+ k: v
1515
+ for k, v in [
1516
+ ("hl", hl),
1517
+ ("id", id),
1518
+ ("part", part),
1519
+ ("regionCode", regionCode),
1520
+ ]
1521
+ if v is not None
1522
+ }
1523
+ response = self._get(url, params=query_params)
1524
+ response.raise_for_status()
1525
+ return response.json()
1526
+
1527
+ def delete_groupitems(self, id=None, onBehalfOfContentOwner=None) -> Any:
1528
+ """
1529
+ Deletes group items based on the provided parameters.
1530
+
1531
+ Args:
1532
+ 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.
1533
+ onBehalfOfContentOwner: Optional; A string representing the content owner on whose behalf the request is being made.
1534
+
1535
+ Returns:
1536
+ A JSON object containing the response from the deletion request.
1537
+
1538
+ Raises:
1539
+ HTTPError: Raised if the HTTP request returns an unsuccessful status code.
1540
+
1541
+ Tags:
1542
+ delete, groupitems, management
1543
+ """
1544
+ url = f"{self.base_url}/groupItems"
1545
+ query_params = {
1546
+ k: v
1547
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
1548
+ if v is not None
1549
+ }
1550
+ response = self._delete(url, params=query_params)
1551
+ response.raise_for_status()
1552
+ return response.json()
1553
+
1554
+ def delete_groups(self, id=None, onBehalfOfContentOwner=None) -> Any:
1555
+ """
1556
+ Deletes specified groups via API, optionally on behalf of a content owner.
1557
+
1558
+ Args:
1559
+ id: Optional unique identifier for the group to delete. If None, no specific group targeted.
1560
+ onBehalfOfContentOwner: Optional content owner ID for delegated authorization.
1561
+
1562
+ Returns:
1563
+ JSON-decoded response indicating operation success/failure.
1564
+
1565
+ Raises:
1566
+ requests.exceptions.HTTPError: Raised for invalid requests, authentication failures, or server errors during deletion.
1567
+
1568
+ Tags:
1569
+ delete, management, async_job, api
1570
+ """
1571
+ url = f"{self.base_url}/groups"
1572
+ query_params = {
1573
+ k: v
1574
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
1575
+ if v is not None
1576
+ }
1577
+ response = self._delete(url, params=query_params)
1578
+ response.raise_for_status()
1579
+ return response.json()
1580
+
1581
+ def get_reports(
1582
+ self,
1583
+ currency=None,
1584
+ dimensions=None,
1585
+ end=None,
1586
+ filters=None,
1587
+ ids=None,
1588
+ include=None,
1589
+ max=None,
1590
+ metrics=None,
1591
+ sort=None,
1592
+ start=None,
1593
+ ) -> Any:
1594
+ """
1595
+ Fetches and returns report data based on specified filtering, sorting, and range criteria.
1596
+
1597
+ Args:
1598
+ currency: Optional; specifies the currency format for monetary values in the report
1599
+ dimensions: Optional; list of dimensions (e.g., 'country', 'device') to include in report breakdowns
1600
+ end: Optional; end date (YYYY-MM-DD format) for the report data range
1601
+ filters: Optional; conditions to filter report rows (e.g., 'country=US,clicks>100')
1602
+ ids: Optional; specific object identifiers (e.g., campaign IDs) to include in the report
1603
+ include: Optional; secondary datasets or entities to include in the report output
1604
+ max: Optional; maximum number of results to return per pagination batch
1605
+ metrics: Optional; list of measurable values to include (e.g., 'clicks', 'conversions')
1606
+ sort: Optional; criteria for sorting results (e.g., '-clicks' for descending order)
1607
+ start: Optional; start date (YYYY-MM-DD format) for the report data range
1608
+
1609
+ Returns:
1610
+ Report data as parsed JSON from the API response
1611
+
1612
+ Raises:
1613
+ requests.exceptions.HTTPError: Raised when the API request fails due to invalid parameters, authentication issues, or server errors
1614
+
1615
+ Tags:
1616
+ fetch, report, api, filter, sort, metrics, management
1617
+ """
1618
+ url = f"{self.base_url}/reports"
1619
+ query_params = {
1620
+ k: v
1621
+ for k, v in [
1622
+ ("currency", currency),
1623
+ ("dimensions", dimensions),
1624
+ ("end", end),
1625
+ ("filters", filters),
1626
+ ("ids", ids),
1627
+ ("include", include),
1628
+ ("max", max),
1629
+ ("metrics", metrics),
1630
+ ("sort", sort),
1631
+ ("start", start),
1632
+ ]
1633
+ if v is not None
1634
+ }
1635
+ response = self._get(url, params=query_params)
1636
+ response.raise_for_status()
1637
+ return response.json()
1638
+
1639
+ def list_tools(self):
1640
+ """
1641
+ Returns a list of tool methods available in the class instance.
1642
+
1643
+ Args:
1644
+ None: This function does not accept any parameters.
1645
+
1646
+ Returns:
1647
+ list: A list containing references to various tool methods associated with job reports, media resources, comments, broadcasts, videos, activities, channels, etc.
1648
+ """
1649
+ return [
1650
+ self.get_jobs_job_reports,
1651
+ self.get_jobs_job_reports_report,
1652
+ self.delete_jobs_job,
1653
+ self.get_jobs,
1654
+ self.get_media_resource_name,
1655
+ self.get_reporttypes,
1656
+ self.delete_captions,
1657
+ self.get_captions,
1658
+ self.delete_comments,
1659
+ self.add_comments_mark_as_spam,
1660
+ self.add_comments_set_moderation_status,
1661
+ self.delete_live_broadcasts,
1662
+ self.add_live_broadcasts_bind,
1663
+ self.add_live_broadcasts_control,
1664
+ self.add_live_broadcasts_transition,
1665
+ self.delete_live_chat_bans,
1666
+ self.delete_live_chat_messages,
1667
+ self.delete_live_chat_moderators,
1668
+ self.delete_videos,
1669
+ self.get_videos_get_rating,
1670
+ self.add_videos_rate,
1671
+ self.add_videos_report_abuse,
1672
+ self.add_watermarks_set,
1673
+ self.add_watermarks_unset,
1674
+ self.get_activities,
1675
+ self.add_channel_banners_insert,
1676
+ self.delete_channel_sections,
1677
+ self.get_channels,
1678
+ self.get_comment_threads,
1679
+ self.get_fanfundingevents,
1680
+ self.get_guecategories,
1681
+ self.get_languages,
1682
+ self.get_regions,
1683
+ self.delete_livestreams,
1684
+ self.delete_play_list_items,
1685
+ self.delete_playlists,
1686
+ self.get_search,
1687
+ self.get_sponsors,
1688
+ self.delete_subscriptions,
1689
+ self.get_superchatevents,
1690
+ self.add_thumbnails_set,
1691
+ self.get_video_abuse_report_reasons,
1692
+ self.get_veocategories,
1693
+ self.delete_groupitems,
1694
+ self.delete_groups,
1695
+ self.get_reports,
1696
+ ]