• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5  margin: 0;
6  padding: 0;
7  border: 0;
8  font-weight: inherit;
9  font-style: inherit;
10  font-size: 100%;
11  font-family: inherit;
12  vertical-align: baseline;
13}
14
15body {
16  font-size: 13px;
17  padding: 1em;
18}
19
20h1 {
21  font-size: 26px;
22  margin-bottom: 1em;
23}
24
25h2 {
26  font-size: 24px;
27  margin-bottom: 1em;
28}
29
30h3 {
31  font-size: 20px;
32  margin-bottom: 1em;
33  margin-top: 1em;
34}
35
36pre, code {
37  line-height: 1.5;
38  font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42  margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46  font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50  border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54  margin-top: 0.5em;
55}
56
57.firstline {
58  margin-left: 2 em;
59}
60
61.method  {
62  margin-top: 1em;
63  border: solid 1px #CCC;
64  padding: 1em;
65  background: #EEE;
66}
67
68.details {
69  font-weight: bold;
70  font-size: 14px;
71}
72
73</style>
74
75<h1><a href="youtube_v3.html">YouTube Data API</a> . <a href="youtube_v3.comments.html">comments</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78  <code><a href="#delete">delete(id)</a></code></p>
79<p class="firstline">Deletes a comment.</p>
80<p class="toc_element">
81  <code><a href="#insert">insert(part, body)</a></code></p>
82<p class="firstline">Creates a reply to an existing comment. Note: To create a top-level comment, use the commentThreads.insert method.</p>
83<p class="toc_element">
84  <code><a href="#list">list(part, pageToken=None, maxResults=None, id=None, parentId=None, textFormat=None)</a></code></p>
85<p class="firstline">Returns a list of comments that match the API request parameters.</p>
86<p class="toc_element">
87  <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
88<p class="firstline">Retrieves the next page of results.</p>
89<p class="toc_element">
90  <code><a href="#markAsSpam">markAsSpam(id)</a></code></p>
91<p class="firstline">Expresses the caller's opinion that one or more comments should be flagged as spam.</p>
92<p class="toc_element">
93  <code><a href="#setModerationStatus">setModerationStatus(id, moderationStatus, banAuthor=None)</a></code></p>
94<p class="firstline">Sets the moderation status of one or more comments. The API request must be authorized by the owner of the channel or video associated with the comments.</p>
95<p class="toc_element">
96  <code><a href="#update">update(part, body)</a></code></p>
97<p class="firstline">Modifies a comment.</p>
98<h3>Method Details</h3>
99<div class="method">
100    <code class="details" id="delete">delete(id)</code>
101  <pre>Deletes a comment.
102
103Args:
104  id: string, The id parameter specifies the comment ID for the resource that is being deleted. (required)
105</pre>
106</div>
107
108<div class="method">
109    <code class="details" id="insert">insert(part, body)</code>
110  <pre>Creates a reply to an existing comment. Note: To create a top-level comment, use the commentThreads.insert method.
111
112Args:
113  part: string, The part parameter identifies the properties that the API response will include. Set the parameter value to snippet. The snippet part has a quota cost of 2 units. (required)
114  body: object, The request body. (required)
115    The object takes the form of:
116
117{ # A comment represents a single YouTube comment.
118  "snippet": { # Basic details about a comment, such as its author and text. # The snippet object contains basic details about the comment.
119    "authorChannelUrl": "A String", # Link to the author's YouTube channel, if any.
120    "viewerRating": "A String", # The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future.
121    "authorDisplayName": "A String", # The name of the user who posted the comment.
122    "channelId": "A String", # The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel.
123    "videoId": "A String", # The ID of the video the comment refers to, if any.
124    "moderationStatus": "A String", # The comment's moderation status. Will not be set if the comments were requested through the id filter.
125    "likeCount": 42, # The total number of likes this comment has received.
126    "authorChannelId": "", # The id of the author's YouTube channel, if any.
127    "parentId": "A String", # The unique id of the parent comment, only set for replies.
128    "publishedAt": "A String", # The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
129    "canRate": True or False, # Whether the current viewer can rate this comment.
130    "textOriginal": "A String", # The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author.
131    "updatedAt": "A String", # The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
132    "authorProfileImageUrl": "A String", # The URL for the avatar of the user who posted the comment.
133    "textDisplay": "A String", # The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc.
134  },
135  "kind": "youtube#comment", # Identifies what kind of resource this is. Value: the fixed string "youtube#comment".
136  "etag": "A String", # Etag of this resource.
137  "id": "A String", # The ID that YouTube uses to uniquely identify the comment.
138}
139
140
141Returns:
142  An object of the form:
143
144    { # A comment represents a single YouTube comment.
145    "snippet": { # Basic details about a comment, such as its author and text. # The snippet object contains basic details about the comment.
146      "authorChannelUrl": "A String", # Link to the author's YouTube channel, if any.
147      "viewerRating": "A String", # The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future.
148      "authorDisplayName": "A String", # The name of the user who posted the comment.
149      "channelId": "A String", # The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel.
150      "videoId": "A String", # The ID of the video the comment refers to, if any.
151      "moderationStatus": "A String", # The comment's moderation status. Will not be set if the comments were requested through the id filter.
152      "likeCount": 42, # The total number of likes this comment has received.
153      "authorChannelId": "", # The id of the author's YouTube channel, if any.
154      "parentId": "A String", # The unique id of the parent comment, only set for replies.
155      "publishedAt": "A String", # The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
156      "canRate": True or False, # Whether the current viewer can rate this comment.
157      "textOriginal": "A String", # The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author.
158      "updatedAt": "A String", # The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
159      "authorProfileImageUrl": "A String", # The URL for the avatar of the user who posted the comment.
160      "textDisplay": "A String", # The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc.
161    },
162    "kind": "youtube#comment", # Identifies what kind of resource this is. Value: the fixed string "youtube#comment".
163    "etag": "A String", # Etag of this resource.
164    "id": "A String", # The ID that YouTube uses to uniquely identify the comment.
165  }</pre>
166</div>
167
168<div class="method">
169    <code class="details" id="list">list(part, pageToken=None, maxResults=None, id=None, parentId=None, textFormat=None)</code>
170  <pre>Returns a list of comments that match the API request parameters.
171
172Args:
173  part: string, The part parameter specifies a comma-separated list of one or more comment resource properties that the API response will include. (required)
174  pageToken: string, The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identifies the next page of the result that can be retrieved.
175
176Note: This parameter is not supported for use in conjunction with the id parameter.
177  maxResults: integer, The maxResults parameter specifies the maximum number of items that should be returned in the result set.
178
179Note: This parameter is not supported for use in conjunction with the id parameter.
180  id: string, The id parameter specifies a comma-separated list of comment IDs for the resources that are being retrieved. In a comment resource, the id property specifies the comment's ID.
181  parentId: string, The parentId parameter specifies the ID of the comment for which replies should be retrieved.
182
183Note: YouTube currently supports replies only for top-level comments. However, replies to replies may be supported in the future.
184  textFormat: string, This parameter indicates whether the API should return comments formatted as HTML or as plain text.
185    Allowed values
186      html - Returns the comments in HTML format. This is the default value.
187      plainText - Returns the comments in plain text format.
188
189Returns:
190  An object of the form:
191
192    {
193    "eventId": "A String", # Serialized EventId of the request which produced this response.
194    "nextPageToken": "A String", # The token that can be used as the value of the pageToken parameter to retrieve the next page in the result set.
195    "kind": "youtube#commentListResponse", # Identifies what kind of resource this is. Value: the fixed string "youtube#commentListResponse".
196    "visitorId": "A String", # The visitorId identifies the visitor.
197    "items": [ # A list of comments that match the request criteria.
198      { # A comment represents a single YouTube comment.
199        "snippet": { # Basic details about a comment, such as its author and text. # The snippet object contains basic details about the comment.
200          "authorChannelUrl": "A String", # Link to the author's YouTube channel, if any.
201          "viewerRating": "A String", # The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future.
202          "authorDisplayName": "A String", # The name of the user who posted the comment.
203          "channelId": "A String", # The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel.
204          "videoId": "A String", # The ID of the video the comment refers to, if any.
205          "moderationStatus": "A String", # The comment's moderation status. Will not be set if the comments were requested through the id filter.
206          "likeCount": 42, # The total number of likes this comment has received.
207          "authorChannelId": "", # The id of the author's YouTube channel, if any.
208          "parentId": "A String", # The unique id of the parent comment, only set for replies.
209          "publishedAt": "A String", # The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
210          "canRate": True or False, # Whether the current viewer can rate this comment.
211          "textOriginal": "A String", # The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author.
212          "updatedAt": "A String", # The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
213          "authorProfileImageUrl": "A String", # The URL for the avatar of the user who posted the comment.
214          "textDisplay": "A String", # The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc.
215        },
216        "kind": "youtube#comment", # Identifies what kind of resource this is. Value: the fixed string "youtube#comment".
217        "etag": "A String", # Etag of this resource.
218        "id": "A String", # The ID that YouTube uses to uniquely identify the comment.
219      },
220    ],
221    "tokenPagination": { # Stub token pagination template to suppress results.
222    },
223    "etag": "A String", # Etag of this resource.
224    "pageInfo": { # Paging details for lists of resources, including total number of items available and number of resources returned in a single page.
225      "totalResults": 42, # The total number of results in the result set.
226      "resultsPerPage": 42, # The number of results included in the API response.
227    },
228  }</pre>
229</div>
230
231<div class="method">
232    <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
233  <pre>Retrieves the next page of results.
234
235Args:
236  previous_request: The request for the previous page. (required)
237  previous_response: The response from the request for the previous page. (required)
238
239Returns:
240  A request object that you can call 'execute()' on to request the next
241  page. Returns None if there are no more items in the collection.
242    </pre>
243</div>
244
245<div class="method">
246    <code class="details" id="markAsSpam">markAsSpam(id)</code>
247  <pre>Expresses the caller's opinion that one or more comments should be flagged as spam.
248
249Args:
250  id: string, The id parameter specifies a comma-separated list of IDs of comments that the caller believes should be classified as spam. (required)
251</pre>
252</div>
253
254<div class="method">
255    <code class="details" id="setModerationStatus">setModerationStatus(id, moderationStatus, banAuthor=None)</code>
256  <pre>Sets the moderation status of one or more comments. The API request must be authorized by the owner of the channel or video associated with the comments.
257
258Args:
259  id: string, The id parameter specifies a comma-separated list of IDs that identify the comments for which you are updating the moderation status. (required)
260  moderationStatus: string, Identifies the new moderation status of the specified comments. (required)
261    Allowed values
262      heldForReview - Marks a comment as awaiting review by a moderator.
263      published - Clears a comment for public display.
264      rejected - Rejects a comment as being unfit for display. This action also effectively hides all replies to the rejected comment.
265
266Note: The API does not currently provide a way to list or otherwise discover rejected comments. However, you can change the moderation status of a rejected comment if you still know its ID. If you were to change the moderation status of a rejected comment, the comment replies would subsequently be discoverable again as well.
267  banAuthor: boolean, The banAuthor parameter lets you indicate that you want to automatically reject any additional comments written by the comment's author. Set the parameter value to true to ban the author.
268
269Note: This parameter is only valid if the moderationStatus parameter is also set to rejected.
270</pre>
271</div>
272
273<div class="method">
274    <code class="details" id="update">update(part, body)</code>
275  <pre>Modifies a comment.
276
277Args:
278  part: string, The part parameter identifies the properties that the API response will include. You must at least include the snippet part in the parameter value since that part contains all of the properties that the API request can update. (required)
279  body: object, The request body. (required)
280    The object takes the form of:
281
282{ # A comment represents a single YouTube comment.
283  "snippet": { # Basic details about a comment, such as its author and text. # The snippet object contains basic details about the comment.
284    "authorChannelUrl": "A String", # Link to the author's YouTube channel, if any.
285    "viewerRating": "A String", # The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future.
286    "authorDisplayName": "A String", # The name of the user who posted the comment.
287    "channelId": "A String", # The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel.
288    "videoId": "A String", # The ID of the video the comment refers to, if any.
289    "moderationStatus": "A String", # The comment's moderation status. Will not be set if the comments were requested through the id filter.
290    "likeCount": 42, # The total number of likes this comment has received.
291    "authorChannelId": "", # The id of the author's YouTube channel, if any.
292    "parentId": "A String", # The unique id of the parent comment, only set for replies.
293    "publishedAt": "A String", # The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
294    "canRate": True or False, # Whether the current viewer can rate this comment.
295    "textOriginal": "A String", # The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author.
296    "updatedAt": "A String", # The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
297    "authorProfileImageUrl": "A String", # The URL for the avatar of the user who posted the comment.
298    "textDisplay": "A String", # The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc.
299  },
300  "kind": "youtube#comment", # Identifies what kind of resource this is. Value: the fixed string "youtube#comment".
301  "etag": "A String", # Etag of this resource.
302  "id": "A String", # The ID that YouTube uses to uniquely identify the comment.
303}
304
305
306Returns:
307  An object of the form:
308
309    { # A comment represents a single YouTube comment.
310    "snippet": { # Basic details about a comment, such as its author and text. # The snippet object contains basic details about the comment.
311      "authorChannelUrl": "A String", # Link to the author's YouTube channel, if any.
312      "viewerRating": "A String", # The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future.
313      "authorDisplayName": "A String", # The name of the user who posted the comment.
314      "channelId": "A String", # The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel.
315      "videoId": "A String", # The ID of the video the comment refers to, if any.
316      "moderationStatus": "A String", # The comment's moderation status. Will not be set if the comments were requested through the id filter.
317      "likeCount": 42, # The total number of likes this comment has received.
318      "authorChannelId": "", # The id of the author's YouTube channel, if any.
319      "parentId": "A String", # The unique id of the parent comment, only set for replies.
320      "publishedAt": "A String", # The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
321      "canRate": True or False, # Whether the current viewer can rate this comment.
322      "textOriginal": "A String", # The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author.
323      "updatedAt": "A String", # The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
324      "authorProfileImageUrl": "A String", # The URL for the avatar of the user who posted the comment.
325      "textDisplay": "A String", # The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc.
326    },
327    "kind": "youtube#comment", # Identifies what kind of resource this is. Value: the fixed string "youtube#comment".
328    "etag": "A String", # Etag of this resource.
329    "id": "A String", # The ID that YouTube uses to uniquely identify the comment.
330  }</pre>
331</div>
332
333</body></html>